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.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Vincent Maverick DuranoPosted Aug 30, 2019, 11:21 PM
Sonu GuptaPosted Aug 29, 2019, 11:51 PM
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();
}
Vincent Maverick DuranoPosted Aug 29, 2019, 1:29 PM