现在的位置: 首页 > 综合 > 正文

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

2013年10月25日 ⁄ 综合 ⁄ 共 549字 ⁄ 字号 评论关闭

前台:

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

抱歉!评论已关闭.