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.
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();
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
| PO1000101 | Supp1 | 24/11/2016 | 850 | ? | ? |
after that code executed the above output will displayed,i need rejected cost and final cost value also.
ramya tPosted Feb 3, 2017, 11:51 PM
var costArray = document.getElementsByName("RC");
var total = 0;
for (var i = 0; i < costArray.length; i++) {
total = total + parseInt(costArray[i].value);
}
$('#totalcost').val(total);
var finalpoamount = parseInt($('#lf').val());
var fop = finalpoamount - total;
$('#finalcost').val(fop);
}
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();
Joginder BangerPosted Feb 3, 2017, 7:44 AM
Joginder BangerPosted Feb 3, 2017, 7:05 AM