how to add a textbox and button inside gridview..
i fetch data from database which contain 3 columns ProductName,ProId and Price.Price will be show inside textbox.if Price is empty in text box then we can enter price using add button or update it..
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.
Munesh SharmaPosted Feb 14, 2015, 4:40 AM
keyurPosted Feb 9, 2015, 11:19 PM
Please go through the below link may be it will help yo to resolve your problems
http://www.c-sharpcorner.com/UploadFile/9f0ae2/gridview-edit-delete-and-update-in-Asp-Net/
thanks
Keyur
Khargesh RajputPosted Feb 9, 2015, 10:54 PM
protected void btnSave_OnClick(object sender, EventArgs e)
{
Button lb = (Button)sender;
GridViewRow row = (GridViewRow)lb.NamingContainer;
if (row != null) { int index = row.RowIndex; //gets the row index selected TextBox tb = (TextBox)GridView1.Rows[index].FindControl("TextBox2");
//code to update data
}
}