Click here to Skip to main content
15,891,842 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
E.g We use following code to find each control on page

C#
foreach (System.Web.UI.Control c in Page.Controls)
 {

}


we can check control by Id ,in Following Code

C#
foreach (System.Web.UI.Control c in Page.Controls)
 {

if (c.ID == "ddlLandCost")
           {
           }
}



but if I want to find control which is in gridview by same above code, guys if you have any idea please help...As my logic is depend on above code.i dont want to use any rowdatabound event...
Posted

C#
foreach (System.Web.UI.Control c in Page.Controls)
 {
Control objChild=((Control)Page.Controls[i]);

}

use like this..
 
Share this answer
 
Comments
Member 8314670 11-Dec-12 6:28am    
hey thnx for rply,
i didnt get your solution what is "i" in here,and i want find control inside gridview by name
you can find your controls like below:
C#
(e.Item.FindControl("txtInsuranceTypeDescription") as SysXTextBox).Text;
where txtInsuranceTypeDescription is a textbox control.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900