c# - Adding Blank Rows to GridView bound to SqlDataSource -


i creating gridview have blank row (consisting of 2 dropdownlists , 1 textbox). there button in footer allow user add row after have filled in first. binding sqldatasource able use insertcommand call stored procedure insert user's data database table. however, not sure how go adding empty row. right now, headers not show until postback call executed. have seen tutorials use datatable add empty row, not work bound dropdownlists. there way add row sqldatasource code behind? following relevant part of asp page:

        <table>         <tr>         <td colspan="2" style="width:100%">            <div>             <asp:updatepanel id="upupdatechecklist" runat="server">                 <contenttemplate>                     <asp:gridview id="gvupdate" runat="server" autogeneratecolumns="false"                                   cssclass="mgrid" pagerstyle-cssclass="pgr"                                   alternatingrowstyle-cssclass="alt"                                   showheaderwhenempty="true"                                   visible="true" cellspacing="2"                                  cellpadding="2" showfooter="true"                                 datasourceid="dsupdate">                         <columns>                             <asp:templatefield headertext="division/context">                                 <itemtemplate>                                     <asp:dropdownlist id="dddivision" runat="server" datatextfield="division" datavaluefield="id" datasourceid="dsdivision"/>                                 </itemtemplate>                             </asp:templatefield>                             <asp:templatefield headertext="application">                                 <itemtemplate>                                     <asp:dropdownlist id="ddapplication" runat="server" datatextfield="application" datavaluefield="id" datasourceid="dsapplication" />                                 </itemtemplate>                             </asp:templatefield>                             <asp:templatefield headertext="task">                                 <itemtemplate>                                     <asp:textbox id="tbtask" runat="server" readonly="false" />                                 </itemtemplate>                             </asp:templatefield>                              <asp:templatefield>                             <footerstyle horizontalalign="right" />                             <footertemplate>                                 <asp:button id="btnadd" text="add new row" runat="server" />                             </footertemplate>                             </asp:templatefield>                         </columns>                     </asp:gridview>                 </contenttemplate>             </asp:updatepanel>           </div>         </td>         </tr>         </table>        <asp:sqldatasource id="dsapplication" selectcommand="select id, applicationname automation.dbo.applications"                           runat="server"                           connectionstring="<%$ connectionstrings:automationdbconnectionstring %>"></asp:sqldatasource>         <asp:sqldatasource id="dsdivision" selectcommand="select id, division automation.dbo.division order application, division"                           runat="server"                           connectionstring="<%$ connectionstrings:automationdbconnectionstring %>"></asp:sqldatasource>        <asp:sqldatasource id="dsupdate" runat="server"                           connectionstring="<%$ connectionstrings:automationdbconnectionstring %>"                           selectcommand="">                           <insertparameters>                             <asp:parameter name="division" dbtype="int32" />                             <asp:parameter name="application" dbtype="int32" />                             <asp:parameter name="task" dbtype="string" />                           </insertparameters>                           </asp:sqldatasource> 

i not sure understand how intend achieve want if want generate empty row, change select command of sql data source union empty dummy row.

   <asp:sqldatasource id="dsapplication" selectcommand="select id, applicationname automation.dbo.applications union select -1 id, '' applicationname " 

Comments

Popular posts from this blog

basic authentication with http post params android -

vb.net - Virtual Keyboard commands -

css - Firefox for ubuntu renders wrong colors -