redirect - C# linkbutton not firing in Gridview within Updatepanel -
i'm hoping can me. have searched web suitable answer haven't found one.
i have following linkbutton
in gridview
(gridview2
) within updatepanel
set updatemode='conditional'
:
<itemtemplate> <asp:linkbutton id="lblsccomments" runat="server" width="80" text='<%#eval("shortcode")%>' commandname="hypersc" oncommand="gridview2_command" commandargument='<%#eval("shortcode")%>'/> </itemtemplate>
with code behind:
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"); } }
unfortunately, when click on link command not firing. working outside of updatepanel
. don't need gridview
refresh, need populate session
variable , lblshortcode
label selected row shortcode
, redirected page.
you have add onrowcommand
event in gridview <asp:gridview id="gridview2" runat="server" onrowcommand="gridview2_rowcommand">
, .cs code in event:
protected void gridview2_rowcommand(object sender, commandeventargs e) { if (e.commandname == "hypersc") { string sc = e.commandargument.tostring(); lblshortcode.text = sc; session["scode"] = sc; server.transfer("~/memberpages/reviews.aspx"); } }
and remove oncommand
event linkbutton.
Comments
Post a Comment