onclick function being called when page loads

highflyeer

New Member
I am new to ASP/C# programming:I have an \[code\]asp:button\[/code\] created as follows:\[code\]<asp:button ID="CreateItem" ClientIDMode="Static" OnClick="btnSave_Click" runat="server" Text="SAVE"></asp:button>\[/code\]In the code behind, I have the following:\[code\]btnSave_Click(object sender, EventArgs e){ //Code here to create an Item }\[/code\]I noticed that when I refresh the page after clicking my button, this function is being called. To verify, I ran the debugger and set a breakpoint inside the \[code\]btnSave_Click\[/code\] function and verified that it was indeed going inside the function when I refresh my page. What am I doing wrong?
 
Back
Top