using ascx file within an aspx file

I have about 5 radio buttons and 3 drop downs that are used and are the same in 3 different pages, instead of duplicating the code in all 3 pages, I thought to use a web user control....the problem is I dont know how to source the drop down list within the aspx file.
I have code that populates the drop downs, is it to be in the ascx code behind or the aspx code behind. I need to understand how I can get the two to talk to each other.
VS.NET 2003 - C#

the master page is called default.aspx
and the user control is called settings.ascx

is this possible to do, what am I missing?
all input appreciated.
Who is Participating?
well i'm saying you just need a method that allows loading of the class...

you have a mycontrol.ascx...  <-- that's considered and give it an id, etc...

<controls: mycontrol id="id" runat="server">

in code-behind:


in the myControl .ascx class

you may want to have a method called loadControl...different from pageload that you can load the control with that takes parameters...

otherwise, it would be simpler to just add to page but that would defeat OOP reusability principals...
you can source the drop down in the ascx itself in the page load...when it's loaded it should also load data...otherwise, you need to create some methods in the ascx like loadData(string dataToLoad) so you can pass parameters from the aspx page...

i.e.  dataToLoad would be a query/ an array/ etc...

you would use the instance that you have on your page to access these message...mycontrol.loadData(textbox.text)  say you're getting your parameter from a user......
solraccheffyAuthor Commented:
sorry that was confusing for me...
are you saying its not easy to do this?
would it be more useful to copy and duplicate the code within the aspx pages?
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.