ramya t

ramya t

  • NA
  • 130
  • 6.8k

store gridview footer row to gridview

Feb 3 2017 6:48 AM
hi,
 
I am using gridview which contains html input textbox rather than asp:textbox,
how to refer the id from gridview and how to store this textbox values to gridview.
i have attached my code here.please help me to resolve this problem.
 
<FooterTemplate>
<input type='text' id="totalcost" name='TC' class='textbox'/><br /><br />
<input type='text' id='finalcost' name='FC' class='textbox' />

</FooterTemplate>
 
c# coding
 
HtmlInputText rc = ((HtmlInputText)gridView.FooterRow.FindControl("totalcost"));
HtmlInputText fpoc = ((HtmlInputText)gridView.FooterRow.FindControl("finalcost"));
MySqlCommand cmd = new MySqlCommand("insert into received values('" + l1.Text + "','" + lsid.Text + "','" + lod.Text + "','" +lf.Value + "','" + rc+ "','" +fpoc + "')", con);
cmd.CommandType = CommandType.Text;
con.Open();
cmd.ExecuteNonQuery();
ScriptManager.RegisterStartupScript(this, this.GetType(), "alert", "alert('Received sucessfully');window.location ='ReceivedProduct.aspx';", true);
con.Close();
 
 
output
       O.No            S.id      date            pcost   Rejectcost Final pcost
 PO1000101Supp124/11/2016850                               ?                            ?         
 
 after that code executed the above output will displayed,i need rejected cost and final cost value also.
 
 
 

Answers (3)