Default.aspx
<asp:Label ID="Label1" runat="server" Text="Label"></asp:Label>
<asp:Button ID="Button1" runat="server" Text="Button" CommandName="button1" CommandArgument="button1" OnCommand="CommandBtn_Click" />
<asp:ImageButton ID="ImageButton1" runat="server" CommandName="ImageButton1" CommandArgument="ImageButton1"
OnCommand="CommandBtn_Click" />
code behind
protected void CommandBtn_Click(object sender, CommandEventArgs e)
{
switch (e.CommandName)
{
case "ImageButton1":
Label1.Text = "imagebuttonclicked";
break;
case "button1":
Label1.Text = "Button1 clicked";
break;
}
}
No comments:
Post a Comment