asp.net - get value from string or store in database? -


this viewcreditrequest html page:

<asp:gridview id="gridview1" runat="server" autogeneratecolumns="false"      cssclass="table table-hover table-striped" onrowcommand="gridview1_rowcommand"     onselectedindexchanged="gridview1_selectedindexchanged">     <columns>             <asp:boundfield datafield="username" headertext="username"              sortexpression="username" />          <asp:boundfield datafield="lastname" headertext="lastname"              sortexpression="lastname" />          <asp:boundfield datafield="firstname" headertext="firstname"              sortexpression="firstname" />          <asp:boundfield datafield="companyname" headertext="companyname"              sortexpression="companyname" />          <asp:boundfield datafield="emailaddress" headertext="emailaddress"              sortexpression="emailaddress" />          <asp:boundfield datafield="companyaddress" headertext="companyaddress"              sortexpression="companyaddress" />          <asp:boundfield datafield="incomerange" headertext="incomerange"              sortexpression="incomerange" />          <asp:boundfield datafield="creditrequest" headertext="creditrequest"              sortexpression="creditrequest" />          <asp:boundfield datafield="contactnumber" headertext="contactnumber" sortexpression="contactnumber" />          <asp:templatefield>                 <itemtemplate>                     <asp:button id="button1" runat="server" text="approve" commandname="approve" commandargument='<%# eval("creditrequest") %>' />                 </itemtemplate>             </asp:templatefield>      </columns> </asp:gridview> 

and code behind:

protected void page_load(object sender, eventargs e)     {         if (!page.ispostback)         {             if (session["islandgasadminfm"] != null)             {                  bindgrid();                 label1.text = "- finance manager";              }             else             {                 response.write("<script>alert('finance manager credentials needed'); window.location.href='login.aspx';</script>");             }         }     }       protected void gridview1_rowcommand(object sender, gridviewcommandeventargs e)     {         system.diagnostics.debugger.break();          if (e.commandname == "approve")         {             string creditrequest = e.commandargument string;         }     }     public void bindgrid()     {         sqlconnection conn = new sqlconnection("data source = 'paulo'; initial catalog=shoppingcartdb;integrated security =true");         sqlcommand cmd = new sqlcommand("select * creditrequests ", conn);          sqldataadapter da = new sqldataadapter("", conn);         da.selectcommand = new sqlcommand("select * creditrequests", conn);         dataset ds = new dataset();         da.fill(ds, "data");         gridview1.datasource = ds.tables[0].defaultview;         gridview1.databind();     } 

what want happen here value of "credit request" in boundfield. bindgrid() working fine, have added

enableviewstate="false" 

to gridview. when click on button, assigns value of credit request string credit request. idea on how can make visible or store in database?


Comments

Popular posts from this blog

ios - RestKit 0.20 — CoreData: error: Failed to call designated initializer on NSManagedObject class (again) -

java - Digest auth with Spring Security using javaconfig -

laravel - PDOException in Connector.php line 55: SQLSTATE[HY000] [1045] Access denied for user 'root'@'localhost' (using password: YES) -