How to bind data from gridview link button to form ctrls ?
i want to bind data from gridview eidt link button to form controls which contains textboxes and dropdownlists for updating data .(not inside gridview control)
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
Vincent Maverick DuranoRank #238 · 10.3K reputationPosted Aug 29, 2019, 9:29 AM EDT
Vincent Maverick DuranoRank #238 · 10.3K reputationPosted Aug 30, 2019, 7:21 PM EDT
Sonu GuptaRank #1,261 · 1.4K reputationPosted Aug 29, 2019, 7:51 PM EDT
Design View -
Code view –
protected void lnkEdit_Click(object sender, EventArgs e)
{
LinkButton lnkEditbtn = sender as LinkButton;
GridViewRow gvrow = lnkEditbtn.NamingContainer as GridViewRow;
int userid = Convert.ToInt32(gdvRecords.DataKeys[gvrow.RowIndex].Value.ToString());
string username = gvrow.Cells[0].Text;
con.Open();
SqlCommand cmd = new SqlCommand("Update UserDetails SET IsActive=’Yes’ where UserId="+userid,con);
int result=cmd.ExecuteNonQuery();
con.Close();
}