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
saifullah khan
NA
335
301.1k
Object reference not set to an instance of an object.
May 28 2011 8:05 AM
i want to edit and update data in grid view but i get he following error.
Object reference not set to an instance of an object.
Line 74: DTSample.Rows[e.RowIndex]["Column0"] = t1.Text;
the code the given below. please help me
protected void GridView1_RowEditing(object sender, GridViewEditEventArgs e)
{
GridView1.EditIndex = Convert.ToInt32(e.NewEditIndex);
HiddenField1.Value = e.NewEditIndex.ToString();
GridView1.DataBind();
}
protected void GridView1_RowUpdating(object sender, GridViewUpdateEventArgs e)
{
TextBox t1 = new TextBox();
TextBox t2 = new TextBox();
t1 = (TextBox)GridView1.Rows[Convert.ToInt32(HiddenField1.Value)].Cells[2].Controls[0];
t2 = (TextBox)GridView1.Rows[Convert.ToInt32(HiddenField1.Value)].Cells[3].Controls[0];
DTSample.Rows[e.RowIndex]["roll"] = t1.Text;
DTSample.Rows[e.RowIndex]["name"] = t2.Text;
GridView1.EditIndex = -1;
GridView1.DataBind();
}
Reply
Answers (
4
)
search in database table
Thread problem