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);
}

posted @ 2013-08-22 22:42  算盘  阅读(2235)  评论(0编辑  收藏  举报