Clicking the button event what events are fired/

Posted by Srinup97 under ASP.NET on 9/20/2013 | Points: 10 | Views : 686 | Status : [Member] | Replies : 2
Hi,

In Button event if it is clicked what are the page events will fired
please tell me

srinivasp


Responses

Posted by: Bandi on: 9/20/2013 [Member] [MVP] Platinum | Points: 25

Up
0
Down
The following are the events of Button
http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.button_events.aspx

Click : Occurs when the Button control is clicked.
Command : Occurs when the Button control is clicked.
DataBinding : Occurs when the server control binds to a data source. (Inherited from Control.)
Disposed : Occurs when a server control is released from memory, which is the last stage of the server control lifecycle when an ASP.NET page is requested. (Inherited from Control.)
Init : Occurs when the server control is initialized, which is the first step in its lifecycle. (Inherited from Control.)
Load : Occurs when the server control is loaded into the Page object. (Inherited from Control.)
PreRender : Occurs after the Control object is loaded but prior to rendering. (Inherited from Control.)
Unload : Occurs when the server control is unloaded from memory. (Inherited from Control.)


Mark This Response as Answer
--
Chandu
http://www.dotnetfunda.com/images/dnfmvp.gif

Srinup97, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Bandi on: 9/20/2013 [Member] [MVP] Platinum | Points: 25

Up
0
Down
sample for Button Command Event
<%@ Page Language="C#" %> 


<script runat="server">

protected void Button_Command(object sender, CommandEventArgs e)
{
if (e.CommandArgument == "FirstButton")
{
Label1.Text = "You clicked on First Button";

}
else if (e.CommandArgument == "SecondButton")
{
Label1.Text = "You clicked on Second Button";
}
}

</script>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>Button Command event in asp.net</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<br />
<asp:Label ID="Label1" runat="server"></asp:Label>
<br />
<br />
<br />
<asp:Button ID="Button1" runat="server" Text="First Button" OnCommand="Button_Command"
CommandArgument="FirstButton" />
&nbsp; &nbsp;
<asp:Button ID="Button2" runat="server" Text="Second Button" OnCommand="Button_Command"
CommandArgument="SecondButton" />
</div>
</form>
</body>
</html>


Mark This Response as Answer
--
Chandu
http://www.dotnetfunda.com/images/dnfmvp.gif

Srinup97, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response