asp.net - GridView OnRowUpdating Event not firing on pop-up form -
i'm having trouble calling onrowupdating event on gridview. gridview has auto-generated edit button working event handler. i've been looking @ other related questions , cannot seem find solution.
the common, popular issue i've come across attempting bind grid on postback during page_load. attempted follow general advice , bind grid when !ispostback, page always in postback-mode leads me believe has default pop-up state.
the form gridview dialog-window (pop-up?) , think has postback behavior , why updating event not firing:
gridview definition:
<saleslogix:slxgridview runat="server" id="oppprodgrdview" gridlines="none" allowpaging="false" selectedrowstyle lightcyan="backcolor" autogeneratecolumns="false" autogenerateeditbutton="true" autogeneratedeletebutton="true" onrowupdating="grdoppproducts_rowupdating" onrowupdated="grdoppproducts_rowupdated" onrowediting="grdoppproducts_rowediting" cellpadding="1" cssclass="datagrid" pagerstyle-cssclass="gridpager" alternatingrowstyle-cssclass="rowdk" rowstyle-cssclass="rowlt" selectedrowstyle-cssclass="rowselected" showemptytable="true" enableviewstate="false" emptytablerowtext="<%$ resources:dgoppproducts.emptytablerowtext %>" expandablerows="true" resizablecolumns="true" currentsortdirection="ascending" currentsortexpression="" datasourceid="sqldatasource2" datakeynames="productid" showsorticon="false" useslxpagertemplate="true" allowsorting="true" pagesize="16" showfooter="true"> <columns> <asp:templatefield headertext="version"> <itemtemplate> <asp:label text='<%# acdgetversion(eval("productid").tostring())%>' runat="server" /> </itemtemplate> </asp:templatefield> <asp:templatefield headertext="name" headerstyle-horizontalalign="left"> <edititemtemplate> <asp:textbox id="txtname" runat="server" text='<%# bind("productname") %>'></asp:textbox> </edititemtemplate> <footertemplate> <asp:textbox id="txtnewname" runat="server" ></asp:textbox> </footertemplate> <itemtemplate> <asp:label id="lblname" runat="server" text='<%# bind("productname") %>'></asp:label> </itemtemplate> </asp:templatefield> </columns> <pagerstyle cssclass="gridpager"></pagerstyle> <rowstyle cssclass="rowlt"></rowstyle> <selectedrowstyle cssclass="rowselected"></selectedrowstyle> </saleslogix:slxgridview>
datasource definition:
<asp:sqldatasource id="sqldatasource2" runat="server" connectionstring="<% provider=sqlncli11;data source=sqlsrv;integrated security=sspi;initial catalog=slxbeta %>" providername="<% system.data.oledb %>" selectcommand="select op.productid, op.sort, ap.productname, '2016' version dbo.opportunity_product op inner join dbo.ext_opportunity_produc ap on op.oppproductid = ap.oppproductid op.opportunityid =?" > <selectparameters> <asp:controlparameter controlid="txtopportunityid" name="opportunityid" propertyname="text"/> </selectparameters> </asp:sqldatasource>
binding:
//mp - bind datasource connection string @ runtime protected void page_load(object sender, eventargs e) { if (visible) { if (!this.ispostback) { //can never reach here } sqldatasource2.providername = "system.data.oledb"; sage.platform.data.idataservice datasvc = applicationcontext.current.services.get<sage.platform.data.idataservice>(); string strconn = datasvc.getconnectionstring(); sqldatasource2.connectionstring = strconn; sqldatasource2.selectparameters["opportunityid"].defaultvalue = txtopportunityid.text; } }
event handlers:
//works protected void grdoppproducts_rowediting(object sender, gridviewediteventargs e) { oppprodgrdview.editindex = e.neweditindex; } //not working protected void grdoppproducts_rowupdating(object sender, gridviewupdateeventargs e) { textbox txtname = (textbox)oppprodgrdview.rows[e.rowindex].findcontrol("txtname"); }
Comments
Post a Comment