Understanding code-behind and functions.

G

Gary

Hello,

I am currently new to .NET, as you can probably tell by my last two or three
threads!!!

Anyway, I am using code behind as much as possible - and am curious about
the way in which functions can be triggered.

It seems if I use an <asp:button...> control, I can assign a function which
exisits on my .CS file, for example:
<asp:button... OnClick="Button_Click">

However, this function is not available on for example a standard <A> tag:
<A href="#" OnClick="Button_Click" runat="server" />

I am *guessing* this is because the button submits the .net form, which
forces the page to read the CS file again, which is when it can execute the
various functions?

My question is, is it possible or sensible to try and access these functions
without using a form button?

Regards,

Gary.
 
W

Willy Denoyette [MVP]

Gary said:
Hello,

I am currently new to .NET, as you can probably tell by my last two or three
threads!!!

Anyway, I am using code behind as much as possible - and am curious about
the way in which functions can be triggered.

It seems if I use an <asp:button...> control, I can assign a function which
exisits on my .CS file, for example:
<asp:button... OnClick="Button_Click">

However, this function is not available on for example a standard <A> tag:
<A href="#" OnClick="Button_Click" runat="server" />

I am *guessing* this is because the button submits the .net form, which
forces the page to read the CS file again, which is when it can execute the
various functions?

My question is, is it possible or sensible to try and access these functions
without using a form button?

Regards,

Gary.


Please post asp.net related questions to the ASP.NET NG <Microsoft.public.framework.aspnet>

Willy.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top