C# LinkButton 带参数的OnCommand事件的写法

前台:

<asp:TemplateField HeaderText ="操作">
  <HeaderStyle HorizontalAlign ="Center" Width ="5%"/>
  <ItemTemplate>                           
    <asp:LinkButton ID="lbtnSearch" Text ="查看"  style=" color:Blue ; text-decoration :underline;" runat ="server" OnCommand             ="lbtnSearch_Command" CommandArgument ='<%#Eval("Id") %>'></asp:LinkButton>                            
  </ItemTemplate>
</asp:TemplateField>


后台:


protected void lbtnSearch_Command(object sender, CommandEventArgs  e)
{
    string Id = e.CommandArgument.ToString();
    Response.Redirect("/WebUI/Admin/main.aspx/WebUI/Admin/Basic/Log/DMImportLogDetail.aspx?Id=" + Id);
}

你可能感兴趣的:(command)