Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Returning a web control from a function?
Message
General information
Forum:
ASP.NET
Category:
Other
Miscellaneous
Thread ID:
00713893
Message ID:
00713928
Views:
13
David,

Almost.

I have a class which specifically deals with this SQL table.

My form instantiates the class. My class opens a connection and grabs the data from SQL. Now I want to build and return a populated dropdownlist control to the page. It would seem to me I need to pass a reference to the page to my class so I can add the control to it.

I am saying this because right now my routine to build the control is getting a "The type or namespace 'Controls' could not be found" since the object I have instantiated does not have anything to add controls to - it is a non visual class.

That's where I stand. Almost but not quite.
Thanks,
Doug
>>My question is - if I am implmenting this as a function, what do I return this as to the calling program - System.Web.WebControls.DropDownList?
>>
>>Or can I not return it - the control is written out as it is implemented?
>>
>
>???
>Controls.Add(control) is the same as
>Page.Controls.Add(control)
>
>you are adding a control to the Controls collection of the Page object. There is no need to return anything. Is this what you were asking?
Douglas Osborne
Don't spend your life just wishing - http://www.AllGiftRegistry.com
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform