asp:button: command name and arguments (VB.net) : Button « Asp Control « ASP.Net






asp:button: command name and arguments (VB.net)

<%@ Page Language=VB Debug=true %>
<script runat=server>
Sub Page_Load(ByVal Sender as Object, ByVal E as EventArgs)

End Sub
Sub CommandButton_Click(Sender As Object, E As CommandEventArgs)
  lblButtonPressed.Text = "You pressed: " _
      & E.CommandName & "<BR>With this argument: " _
      & E.CommandArgument & "<BR>"
End Sub
</SCRIPT>
<HTML>
<HEAD>
<TITLE>Using a Button Control as a Command Button</TITLE>
</HEAD>
<form runat="server">
<asp:label 
    id="lblButtonPressed" 
    runat="server"
/>
<BR><BR>
<asp:button 
    id="butSortName"
    text="Sort By Name"
    oncommand="CommandButton_Click"
    commandname="Sort"
    commandargument="By Name"
    runat="server"
/>
<BR><BR>
<asp:button 
    id="butSortPrice"
    text="Sort By Price"
    oncommand="CommandButton_Click"
    commandname="Sort"
    commandargument="By Price"
    runat="server"
/>
<BR><BR>
<asp:button 
    id="lnkbutNewSearch"
    text="New Search"
    oncommand="CommandButton_Click"
    commandname="New Search"
    commandargument="None"
    runat="server"
/>
</form>
</BODY>
</HTML>
           
       








Related examples in the same category

1.Event in code behind file (VB.net)
2.Event driven page (VB.net)
3.Set Button text (VB.net)
4.asp:button event to change the label text (VB.net)
5.Button action Command and Parameter (VB.net)
6.Add action listener to a server Button (VB.net)
7.asp button postbackurl (C#)
8.asp button on client click (C#)
9.Button counter: click and change button label (C#)
10.Add action listener to asp Button by delegate (C#)
11.Read input and do the calculation in Button action listener (C#)
12.Button event Handler (C#)
13.onmouseover and onmouseout events
14.OnClientClick event
15.CausesValidation="False"