c# - Update with detailsview and sqldatasource -


it posible update row detailsview control , sqldatasource?

any example?


edit:

solved

<asp:sqldatasource id="sqldatasource2" runat="server" connectionstring="<%$ connectionstrings:bd %>" providername="system.data.sqlclient" selectcommand="select tabla.id, tabla.nombre tabla tabla.id = 1" updatecommand="update tabla set nombre=@nombre id=@id">                     <updateparameters>                         <asp:parameter name="id" type="int32" />                         <asp:parameter name="nombre" type="string" />                     </updateparameters>                 </asp:sqldatasource>                  <asp:detailsview id="detailsview1" defaultmode="edit" runat="server" height="50px" width="125px" datasourceid="sqldatasource2" autogeneraterows="false" autogenerateeditbutton="true">                      <fields>                         <asp:templatefield headertext="id">                             <edititemtemplate>                                 <asp:textbox id="textbox1" runat="server" text='<%# bind("id") %>'></asp:textbox>                             </edititemtemplate>                         </asp:templatefield>                         <asp:templatefield headertext="nombre">                             <edititemtemplate>                                 <asp:textbox id="textbox2" runat="server" text='<%# bind("nombre") %>'></asp:textbox>                             </edititemtemplate>                     </fields>                  </asp:detailsview> 

yes, possible, can set autogenerateeditbutton property true in detailsview

you better read msdn documentations related this.


Comments

Popular posts from this blog

c# - DetailsView in ASP.Net - How to add another column on the side/add a control in each row? -

javascript - firefox memory leak -

Trying to import CSV file to a SQL Server database using asp.net and c# - can't find what I'm missing -