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
PankaJ D
NA
154
0
upadating record in gridview
Jan 4 2011 4:25 AM
I am trying to update record in grid view using following commmand.But it does not Update the record.
protected void GridView1_RowUpdating(object sender, GridViewUpdateEventArgs e)
{
GridViewRow row = (GridViewRow)GridView1.Rows[e.RowIndex];
Label lbl = (Label)row.FindControl("label8");
TextBox txtq = (TextBox)row.FindControl("TextBox7");
GridView1.EditIndex = -1;
cn.Open();
string sql = "UPDATE Q_Master SET Que = '" + txtq.Text + " ' WHERE Q_id='" + lbl.Text + "' ";
SqlCommand cmd = new SqlCommand(sql, cn);
cmd.ExecuteNonQuery();
cn.Close();
LoadBind();
}
LoadBind()
{
string sql = "SELECT * FROM Q_Master";
SqlCommand cmd = new SqlCommand(sql, cn);
SqlDataAdapter da = new SqlDataAdapter(cmd);
da.Fill(ds, "Q_Master");
GridView1.DataSource = ds;
GridView1.DataBind();
}
Reply
Answers (
4
)
How to Add rows Dynamically to GridView
Supress Text Object