巧用Button的Command事件,用CommandArgument来传递参数

< asp:Button  ID ="Button1"  runat ="server"  Text ="评选"  CommandArgument ='<%#  Eval("Id") % > ' OnCommand="Button1_Command" />

 

  Protected   Sub  Button1_Command( ByVal  sender  As   Object ByVal  e  As  System.Web.UI.WebControls.CommandEventArgs)
        Response.Write(e.CommandArgument)
 
End Sub

这样就可以用  Button 来传递参数了

你可能感兴趣的:(Asp.Net,2.0)