我希望有人能帮助我。我在网上搜索了一个合适的答案,但没有找到。
我LinkButton在GridView( GridView2) 中有以下内容,它在一UpdatePanel组 to 中UpdateMode='Conditional':
<ItemTemplate>
<asp:LinkButton ID="lblSCcomments" runat="server" Width="80"
Text='<%#Eval("ShortCode")%>' CommandName="hyperSC"
OnCommand="GridView2_Command"
CommandArgument='<%#Eval("ShortCode")%>'/>
</ItemTemplate>
后面有这段代码:
protected void GridView2_Command(object sender, CommandEventArgs e)
{
if (e.CommandName == "hyperSC")
{
string sc = e.CommandArgument.ToString();
lblShortCode.Text = sc;
Session["scode"] = sc;
Server.Transfer("~/MemberPages/reviews.aspx");
}
}
不幸的是,当我单击链接时,该命令没有触发。但这在UpdatePanel. 我不需要Gridview刷新,只需要用所选行填充Session变量和lblShortCode标签Shortcode并重定向到另一个页面。