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.
solraccheffyAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

silemoneCommented:
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?
silemoneCommented:
well i'm saying you just need a method that allows loading of the class...


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

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

in code-behind:

id.loadControl(someParameter);




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...

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
C#

From novice to tech pro — start learning today.