C#/ASP.NET code behind access the objects in Web Control on the fo

J

JB

Helllo

When using C# and ASP.NET the code behind pages intellesense easily
accesses the objects used on the form for (example datagridview1.datasource =
mydb) , but if the datagridview is placed in a Web Control on the form how
can intellisense access the datagridview1.datasource property when the
datagridview object resides in a Web Control that is on the form?
 
S

Scott M.

Because container controls are completely compiled until runtime, the VS
editor can't always give you intellisense on them, even when you fully
qualify what it is you want.
 
J

JB

Hello Scott

Since intellisense cant access the objects residing in a Web Control,
how can I syntactly (preferably) or any other way do something like
populating DropDownLists, DataGridViews and TextBoxes that reside in a Web
Control on a form using the codebehind, if it is possble?

JB
 
M

Muqadder

You'll have to loop through the yourwebcontrol.Controls list of the web
control that has your grids, dropdowns (effectively any child control it
contains) and check the control type of each. If you are looking for a
Dropdowncontrol and the controltype of currnet object is dropdown list
(you'll get this through intellisense), you'll assign the object to a
dropdown control instance (e.g DropdownList myDropdown = <curent child
control>). From then on, you can use the dropdown object as you normally do.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top