I have 2 gridviews, one inside a modal popup(gvSuppliers) and one on the page(gvFirms). The header row of the gvFirms has 4 text boxes. I can find those controls easily inside the selectedindexChanged method of gvSuppliers easilly when one row gvSupliers is selected. My problem arises when i try to find the 4 textboxes inside the emptydatatemplate of gvFirms.
Eg.
Expand|Select|Wrap|Line Numbers
- protected void gvSuppliers_SelectedIndexChanged(object sender, EventArgs e)
- {
- GridViewRow row = gvSuppliers.SelectedRow;
- LinkButton linkbutton = (LinkButton)row.Cells[0].FindControl("LinkButton1");
- TextBox SupplierID = (TextBox)gvFirms.HeaderRow.FindControl("txtNewSupplierId");//This is the first textbox
- }
one thought that crossed my mind was to programatically call the rowcommand event within the gvSuppliers_SelectedIndexChanged method and so i should have the GridViewCommandEventArgs e and then i could say something to this effect inside gvFirms_Rowcommand method
Expand|Select|Wrap|Line Numbers
- if (e.CommandName.Equals("AddNewItem"))
- {
- GridViewRow row = (GridViewRow)((e.CommandSource as Button).NamingContainer);
- string categoryName = (row.FindControl("txtCategoryName") as TextBox).Text;
Please help asap