Given the form:
<form runat="server">
**Omitted field data for simplicity**
<asp:Button runat="server" id="btn_addNewPrice" OnClick="newPrice_click" Text="Add New Price" />
</form>
And the code behind:
// A new price has been entered
void newPrice_click(object sender, EventArgs e)
{
// Get form values
DateTime frm_datestart = DateTime.Parse(dateStart.Text);
DateTime frm_dateend = DateTime.Parse(dateEnd.Text);
double frm_percent = double.Parse(percentage.Text);
}
I get the error:
CS1061: ‘ASP.admin_editproduct_aspx’
does not contain a definition for
‘newPrice_click’ and no extension
method ‘newPrice_click’ accepting a
first argument of type
‘ASP.admin_editproduct_aspx’ could be
found (are you missing a using
directive or an assembly reference?)
If you put a breakpoint on your code, you can see if the code is hit (the breakpoint gets hit).
I think you should use an asp:button or implement the postback using the following tuterial:
http://www.dotnetspider.com/resources/1521-How-call-Postback-from-Javascript.aspx
edit:
What i always do, I select the button, go to properties and then on the events tab (lighting symbol) I select the event that I want to use for click, or i double click to make a new one.