TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Geet Priyadarshini
NA
57
9k
Getting an error while using update in gridview.
Mar 8 2018 4:15 AM
Specified argument was out of the range of valid values. Parameter name: index is the error which i constantly getting in my code (using visual studio 2005 asp C#)
protected void GridView1_RowUpdating(object sender, GridViewUpdateEventArgs e)
{
try
{
string req_no = ((TextBox)GridView1.Rows[e.RowIndex].Cells[1].Controls[0]).Text;
string req_dt = ((TextBox)GridView1.Rows[e.RowIndex].Cells[2].Controls[0]).Text;
string req_by = ((TextBox)GridView1.Rows[e.RowIndex].Cells[3].Controls[0]).Text;
string mat_cd = ((TextBox)GridView1.Rows[e.RowIndex].Cells[4].Controls[0]).Text;
string mat_desc = ((TextBox)GridView1.Rows[e.RowIndex].Cells[5].Controls[0]).Text;
string mat_type_cd = ((TextBox)GridView1.Rows[e.RowIndex].Cells[6].Controls[0]).Text;
string stor_loc_cd = ((TextBox)GridView1.Rows[e.RowIndex].Cells[7].Controls[0]).Text;
string base_uom_cd = ((TextBox)GridView1.Rows[e.RowIndex].Cells[8].Controls[0]).Text;
string pur_grp_cd = ((TextBox)GridView1.Rows[e.RowIndex].Cells[9].Controls[0]).Text;
string hsn_cd = ((TextBox)GridView1.Rows[e.RowIndex].Cells[10].Controls[0]).Text;
string mat_long_desc = ((TextBox)GridView1.Rows[e.RowIndex].Cells[11].Controls[0]).Text;
string tax_ind = ((TextBox)GridView1.Rows[e.RowIndex].Cells[12].Controls[0]).Text;
string active_ind = ((TextBox)GridView1.Rows[e.RowIndex].Cells[13].Controls[0]).Text;
string del_ind = ((TextBox)GridView1.Rows[e.RowIndex].Cells[14].Controls[0]).Text;
conn.Open();
OleDbCommand cmd = new OleDbCommand();
cmd.CommandText = " update MATERIAL_MASTER set req_dt='" + req_dt + "',req_by='" + req_by + "',mat_cd='" + mat_cd + "',mat_desc='" + mat_desc + "',mat_type_cd='" + mat_type_cd + "',stor_loc_cd='" + stor_loc_cd + "',base_uom_cd='" + base_uom_cd + "',pur_grp_cd='" + pur_grp_cd + "',hsn_cd='" + hsn_cd + "',mat_long_desc='" + mat_long_desc + "',tax_ind='" + tax_ind + "',active_ind='" + active_ind + "',del_ind='" + del_ind + "' where req_no='" + req_no + "'";
cmd.Connection = conn;
cmd.ExecuteNonQuery();
conn.Close();
GridView1.EditIndex = -1;
BindGrid();
}
catch (Exception ex)
{
Response.Write(ex.Message);
}
}
Reply
Answers (
10
)
angularjs,when am giving search option it is showing extra
How to change layout page after login in mvc using angularjs