First look at aspx:
CopyCode The Code is as follows: <! Doctype HTML public "-// W3C // dtd xhtml 1.0 transitional // en" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<HTML xmlns = "http://www.w3.org/1999/xhtml">
<Head runat = "server">
<Title> Petter Liu demo </title>
<SCRIPT src = "http://img.jb51.net/jslib/jquery/jquery14.js" type = "text/JavaScript"> </SCRIPT>
<SCRIPT type = "text/JavaScript">
$ (Function (){
$ ("Input: Submit"). Click (function (){
$ ("# Hiddenfield1"). Val ($ (this). ATTR ("ID ")
+ "Cause a PostBack ");
});
});
</SCRIPT>
</Head>
<Body>
<Form ID = "form1" runat = "server">
<Div>
<Asp: button id = "button1" runat = "server" text = "button1"/>
<Asp: button id = "button2" runat = "server" text = "button2"/>
<Asp: button id = "button3" runat = "server" text = "button3"/>
<Asp: hiddenfield id = "hiddenfield1" runat = "server"/>
</Div>
</Form>
</Body>
</Html>
Then write this in the sever:
Copy codeThe Code is as follows: // <summary>
/// Handles the load event of the page control.
/// </Summary>
/// <Param name = "sender"> the source of the event. </param>
/// <Param name = "E"> the <see CREF = "system. eventargs"/> instance containing the event data. </param>
/// <Remarks> author Petter Liu http://wintersun.cnblogs.com </remarks>
Protected void page_load (Object sender, eventargs E)
{
Response. Write (hiddenfield1.value );
}
Simple code.
I hope this post will be helpful to you.