asp.net - On GridView_RowEdititng Pass Selected Column value in session -
i have gridview
<asp:gridview id="grdmod" runat="server" emptydatatext="no data found" autogeneratecolumns="false" skinid="prggrid1" allowpaging="true" bordercolor="maroon" borderwidth="2px" width="600px"> <headerstyle font-names="arial" font-size="10pt" horizontalalign="center" /> <columns> <asp:templatefield headertext="code"> <itemstyle font-names="arial" font-size="9pt" horizontalalign="center" /> <headerstyle font-names="arial" font-size="10pt" font-bold="true" horizontalalign="center" /> <itemtemplate> <asp:label id="lblcode" runat="server" text='<%#bind("code") %>' /> </itemtemplate> </asp:templatefield> <asp:templatefield headertext="modify/edit"> <itemtemplate> <asp:imagebutton id="btnmodify" runat="server" commandname="edit" src="../images/edit.gif" /> </itemtemplate> <headerstyle font-size="10pt" font-names="arial"></headerstyle> <itemstyle font-size="9pt" font-names="arial"></itemstyle> </asp:templatefield> </columns> </asp:gridview>
on gridview.rowedititng
event want pass column value in session.
how this?
your aspx page this:
<asp:gridview id="grdmod" runat="server" emptydatatext="no data found" autogeneratecolumns="false" skinid="prggrid1" allowpaging="true" bordercolor="maroon" borderwidth="2px" width="600px" onrowediting="grdmod_rowediting"> <headerstyle font-names="arial" font-size="10pt" horizontalalign="center" /> <columns> <asp:templatefield headertext="code"> <itemstyle font-names="arial" font-size="9pt" horizontalalign="center" /> <headerstyle font-names="arial" font-size="10pt" font-bold="true" horizontalalign="center" /> <itemtemplate> <asp:label id="lblcode" runat="server" text='<%#bind("code") %>' /> </itemtemplate> <edititemtemplate> <asp:label id="lblecode" runat="server" text='<%#bind("code") %>' /> </edititemtemplate> </asp:templatefield> <asp:templatefield headertext="modify/edit"> <itemtemplate> <asp:imagebutton id="btnmodify" runat="server" commandname="edit" src="../images/edit.gif" /> </itemtemplate> <headerstyle font-size="10pt" font-names="arial"></headerstyle> <itemstyle font-size="9pt" font-names="arial"></itemstyle> </asp:templatefield> </columns> </asp:gridview>
and cs file this:
protected void grdmod_rowediting(object sender, gridviewediteventargs e) { grdmod.editindex = e.neweditindex; fillgrd(); label l = (label)grdmod.rows[e.neweditindex].findcontrol("lblecode"); string val = l.text; session["name"] = val; }
Comments
Post a Comment