3/28/2013
How to Update the Data in Gridview using C#
protected void gdv_RowUpdating(object sender, GridViewUpdateEventArgs e)
{
TextBox tb1 = (TextBox)gdMidmasterSearch.Rows[e.RowIndex].Cells[1].Controls[0];
TextBox tb2 = (TextBox)gdMidmasterSearch.Rows[e.RowIndex].Cells[2].Controls[0];
TextBox tb3 = (TextBox)gdMidmasterSearch.Rows[e.RowIndex].Cells[3].Controls[0];
TextBox tb4 = (TextBox)gdMidmasterSearch.Rows[e.RowIndex].Cells[4].Controls[0];
TextBox tb5 = (TextBox)gdMidmasterSearch.Rows[e.RowIndex].Cells[5].Controls[0];
TextBox tb6 = (TextBox)gdMidmasterSearch.Rows[e.RowIndex].Cells[6].Controls[0];
TextBox tb7 = (TextBox)gdMidmasterSearch.Rows[e.RowIndex].Cells[7].Controls[0];
TextBox tb8 = (TextBox)gdMidmasterSearch.Rows[e.RowIndex].Cells[8].Controls[0];
TextBox tb9 = (TextBox)gdMidmasterSearch.Rows[e.RowIndex].Cells[9].Controls[0];
TextBox tb10 = (TextBox)gdMidmasterSearch.Rows[e.RowIndex].Cells[10].Controls[0];
TextBox tb11 = (TextBox)gdMidmasterSearch.Rows[e.RowIndex].Cells[11].Controls[0];
DB_MIDMaster objMidUpdate = new DB_MIDMaster();
objMidUpdate.strMid = Convert.ToString (tb1.Text);
objMidUpdate.strTid = Convert.ToString(tb2.Text);
objMidUpdate.strSuperMid = Convert.ToString(tb3.Text);
objMidUpdate.strSuperTid = Convert.ToString(tb4.Text);
objMidUpdate.strPaymentOption = tb5.Text;
objMidUpdate.strEmiMonth = tb6.Text;
objMidUpdate.strtypes = tb7.Text;
objMidUpdate.strPaymentModes = tb8.Text;
objMidUpdate.strLocation = tb9.Text;
objMidUpdate.strMSFCharges = tb10.Text;
objMidUpdate.strServiceTax = tb11.Text;
objMidUpdate.MidMaster_Update();
gdMidmasterSearch.EditIndex = -1;
lblMessage.Visible = true;
lblMessage.InnerHtml = "Details are Updated Successfully.";
BindToGrid();
}
Subscribe to:
Post Comments
(
Atom
)
No comments :
Post a Comment