Click here to Skip to main content
15,915,839 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hi i have one doubt of button click in asp.net, i have placed the button control with the OnClick event like
<asp:Button ID="mybutton" runat="server" Text="Insert" onclick="mybutton_Click" />

and some other controls(buttons, textboxes) in .aspx page. When i run the page, the button displays in the page source of the browser like
<input type="submit" name="mybutton" value="Insert" id="mybutton" />

here, it does not display the onclick event, then how the page calls the button click on the server side, how the server side identify which button cause the submit, and how this page moves to the server side.
Posted
Updated 6-Apr-12 4:36am
v2

If you look at the rendered output for your page you should see an section at the top called VIEWSTATE. This encoded and encrypted block describes to the ASP.NET engine the server controls are on the page and what there state is. When the form is posted back to the server it will read this data, reconstitute the controls and fire any events.

To this for more detail
ASP.NET Page Life Cycle Overview[^]
 
Share this answer
 
v2
Comments
bbirajdar 6-Apr-12 10:42am    
My 4
The current value of every control on a Web Form is contained in the postback request. This is referred to as the Post Data

The content of the ViewState is also contained in the Post Data. ViewState holds the original property values of every control on a Web Form - before the user made any changes

If a postback was caused, for example, by a button click, Post Data is used by the IIS server to identify the button that caused the postback
 
Share this answer
 
Your asp tag is having runat="server". Its executing in server and it produce relevant html tag and also bind your click event and give you response of that page. Then you are viewing your page source ,you are able to see only the browser executable things like html,css,javascript,etc.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900