Sender sender switch (sender.name) { case "button1" case "button2" }
Dim arg As String = sender.CommandArgument Select Case arg Case "next" If (MyDataGrid.CurrentPageIndex < (MyDataGrid.PageCount - 1)) Then MyDataGrid.CurrentPageIndex += 1 End If Case "prev" If (MyDataGrid.CurrentPageIndex > 0) Then MyDataGrid.CurrentPageIndex -= 1 End If Case "last" MyDataGrid.CurrentPageIndex = (MyDataGrid.PageCount - 1) Case Else 'page number MyDataGrid.CurrentPageIndex = System.Convert.ToInt32(arg) End Select两个button的事件在html中制定到上面的事件中。
{
string Comm = e.CommandName.ToString();
if("aaa"==Comm)
{
TextBox1.Text = "aaa";
} if("bbb"==Comm)
{
TextBox1.Text = "bbb";
}
}
{
Button bu=(Button)sender;
if (bu.CommandName ="aaa")
{
}
}
{
Button bu=(Button)sender;
if (bu.CommandName ="aaa")
{
}
}
{
Button bu=(Button)sender;
if (bu.CommandName ="aaa")
{
}
}
switch (sender.name)
{
case "button1"
case "button2"
}
Case "next"
If (MyDataGrid.CurrentPageIndex < (MyDataGrid.PageCount - 1)) Then
MyDataGrid.CurrentPageIndex += 1
End If
Case "prev"
If (MyDataGrid.CurrentPageIndex > 0) Then
MyDataGrid.CurrentPageIndex -= 1
End If
Case "last"
MyDataGrid.CurrentPageIndex = (MyDataGrid.PageCount - 1)
Case Else
'page number
MyDataGrid.CurrentPageIndex = System.Convert.ToInt32(arg)
End Select两个button的事件在html中制定到上面的事件中。
private void Button1_Click(object sender, System.EventArgs e)
{
Button bu=(Button)sender;
if (bu.CommandName ="aaa")
{}
}
的这个就很好了
if( sender == button1)
{
}
else if( sender == button2)
{
}
就可以了