I have a button:
<button type="submit" class="contact" onclick="click">
and I have a c# code behind function:
protected void click(object sender, EventArgs e)
{
contact_label.Text = "tester";
}
and there is a label on my page:
<asp:Label id="contact_label"...
The trouble is when I click the button the ‘click’ function is not being called, why not? How do I remedy it?
you need a runat=server
try this:
If you don’t want to use the asp:button
Here is an article explaining it:
http://ondotnet.com/pub/a/dotnet/2001/06/21/webforms.html?page=2
If you don’t want to use a server side button at all, you could on the page_load event check which button did the submit action (through the request.form). You won’t have an object to call the event handler, but you could but the code in another method and perform the same action.