asp.net - How to change Formview mode with javascript -
i have formview
on web page , want change formview mode
. want change javascript
.
is possible? have repeater
has buttons. , have button outside of repeater. when click button outside, shows formview in popup. formview has insert mode. , when click button on repeater, shows formview
in popup
. formview
has edit mode. cant c#. may if javascript
, works
<asp:toolkitscriptmanager id="toolkitmanager1" runat="server"></asp:toolkitscriptmanager> <asp:linkbutton runat="server" id="lnkfake" /> <asp:imagebutton id="img1" runat="server" postbackurl="javascript:$find('popupbehavior').show();"/> <asp:modalpopupextender backgroundcssclass="modalbackground" id="popupcompanyemployee" runat="server" popupcontrolid="panel1" targetcontrolid="lnkfake" behaviorid="popupbehavior" cancelcontrolid="btnkapat"> </asp:modalpopupextender> <asp:panel id="panel1" runat="server" cssclass="modalpopup"> <asp:updatepanel id="updatepanel1" runat="server"> <contenttemplate> <asp:formview id="fv1" runat="server" datasourceid="sqldatasource1" datakeynames="id" defaultmode="insert"> <insertitemtemplate> <asp:label id="lblproductname" runat="server" text="productname"></asp:label> <asp:textbox id="txtproductname" runat="server" text='<%# eval("productname") %>'></asp:textbox> <asp:label id="lblquantity" runat="server" text="quantity"></asp:label> <asp:textbox id="txtquantity" runat="server" text='<%# eval("quantity") %>'></asp:textbox> <asp:label id="lblunitprice" runat="server" text="unitprice"></asp:label> <asp:textbox id="txtunitprice" runat="server" text='<%# eval("unitprice") %>'></asp:textbox> </insertitemtemplate> <edititemtemplate> <asp:label id="lblproductname" runat="server" text="productname"></asp:label> <asp:textbox id="txtproductname" runat="server" text='<%# eval("productname") %>'></asp:textbox> <asp:label id="lblquantity" runat="server" text="quantity"></asp:label> <asp:textbox id="txtquantity" runat="server" text='<%# eval("quantity") %>'></asp:textbox> <asp:label id="lblunitprice" runat="server" text="unitprice"></asp:label> <asp:textbox id="txtunitprice" runat="server" text='<%# eval("unitprice") %>'></asp:textbox> </edititemtemplate> </asp:formview> </contenttemplate> <triggers> <asp:asyncpostbacktrigger controlid="btnkapat"/> </triggers> </asp:updatepanel> <asp:button id="btnkapat" runat="server" text="kapat"/> </asp:panel> <asp:repeater id="rpr1" runat="server" datasourceid="sqldatasource1"> <itemtemplate> <asp:label id="lblid" runat="server" text='<%#eval("id") %>'></asp:label> <asp:label id="lblproductname" runat="server" text='<%#eval("productname") %>'></asp:label> <asp:label id="lblquantity" runat="server" text='<%#eval("quantity") %>'></asp:label> <asp:label id="lblunitprice" runat="server" text='<%#eval("unitprice") %>'></asp:label> <asp:imagebutton id="imgpopup" runat="server" postbackurl="javascript:$find('popupcbehavior').show();" /> </itemtemplate> </asp:repeater> <asp:sqldatasource runat="server" id="sqldatasource1" connectionstring='<%$ connectionstrings:net2connectionstring %>' selectcommand="select * [productsra]"></asp:sqldatasource>
basically, changing mode of formview
reflects controls (html) rendered page.
so not happen purely on client-side. use update panel , asyn post back
is done , form view html refreshed.
have reference formview
documentation reference here
hope clears doubt bit
Comments
Post a Comment