Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Finding ID of ASP.NET grid controls
Message
General information
Forum:
ASP.NET
Category:
WebForms
Miscellaneous
Thread ID:
00758496
Message ID:
00758590
Views:
17
Now I understand what you are referring to. You can assign and find out the id by going into the HTML representation of your ASP.NET page (click on the HTML tab on the lower left of your aspx page when viewing it in the designer). Look in the html for information regarding the datagrid. You will find the controls inside your datagrid there. Each control will have an ID assigned to it which is what you will use for FindControl. If you look at the samples in my article and look in the HTML tab, you will see the ids that I use in the code-behind.

>I think my question is more basic than that. In your article at usingaspnetwithvfp7.asp I see the following code:
>
>
>      // Assign the objects to each object in the edited row.
>      objCompanyCtrl = (TextBox)objArgs.Item.FindControl("txtCompany");
>      objContactCtrl = (TextBox)objArgs.Item.FindControl("txtContact");
>      objCustIDCtrl = (Label)objArgs.Item.FindControl("lblCustID");
>
>
>I have setup my own datagrid and have no idea what the controls are called within it. Where did you assign "txtCompany", etc. to the datagrid? I have looked at the design properties and the ASP/HTML code and can't see where to assign ID's to the columns so I know what to put in the findcontrol() method. Probably just amazingly simple, but I can't find it.
>
>
>
>>Hi Steve,
>>
>>Check out message #745148 to see how I use the FindControl method to add javascript to a column in the DataGrid. This should provide you with the syntax of how to access the information you need to get at. Hope this helps.
>>
>>>I have an ASP.NET web datagrid setup to edit some data. I'm trying to setup a save function which needs to reference the text controls in the row. I've tried to use the findcontrol() method, but I cannot find ANYWHERE anything that tells me the name of the column controls. So far my guesses of the datasource and header caption are incorrect.
>>>
>>>In vfp it would be as simple as grid.column, but I can see no way to do that in ASP.NET.
>>>
>>>TIA~
-----------------------------------------

Cathi Gero, CPA
Prenia Software & Consulting Services
Microsoft C# / .NET MVP
Mere Mortals for .NET MVP
cgero@prenia.com
www.prenia.com
Weblog: blogs.prenia.com/cathi
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform