asp.net 2.0: class file and .aspx page concept question

R

Ranginald

How can you get a class such as myClass.cs, to create a control such
as a listbox that wil be used in a placeholder control on an .aspx page
where the .aspx page has yet to be created so the class doesn't know
about it yet. (e.g so there are no dependencies in the class)..

So if there are 10 .aspx pages, page1.aspx, page2.aspx, etc. , and each
one has a control <asp:placeholder ID="PlaceHolder1"......>, how do
you

1. code a class, myClass.cs to create a listbox that will be placed on
any one of the above .aspx pages but in the <PlaceHolder1> control. (I
know how to do it with a user control e.g. default.aspx and
default.aspx.cs -- but how to do it with default.aspx, default.aspx.cs
AND myClass.cs).


2. instantiate this code from myClass.cs from the page1.aspx.cs,
page2.aspx.cs, etc.

Thanks!
 
K

Karl Seguin [MVP]

I think my response in the previous thread is on the right track. If your
base class declares PlaceHolder1 and your pages create it via
<asp:placeholder id="placeholder1" runat="server" /> your baseclass will
have a reference to the placeholder and can creaste the listbox and place it
into it. This can be done in the onLoad event of the baseclass or by calling
a "CreateListBox" protected method of the base class...

Karl
 

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

Members online

No members online now.

Forum statistics

Threads
473,997
Messages
2,570,239
Members
46,827
Latest member
DMUK_Beginner

Latest Threads

Top