Ideas on design - Restated

N

Nick

Hi,

I have asked this question in a few guises recently, and not had much
response. But I dont think what I am asking is too obscure, so I am hoping
I just need to rephrase.

When a view is rendering itself (say Foo.aspx/Foo.aspx.cs), during rendering
it realises it needs a secondary view to do something (lets call it
Bar.aspx/Bar.aspx.cs). The logic is somehting like:

.... during a render in Foo....

1. if Need to render secondary view then
begin
2. Bar = CreateBarClassSomehow();
3. Make Bar render itself;
4. Paste rendered Bar view into current view
end;
5. Render foo normally

I want to be able to create an ASPX file programmatically, but by doing so I
want the created ASPX file to execute as if it had been accessed directly
via a URL. The problem I am getting when creating the ASPX file manually,
is that if I access controls in Page_Load, they are null. But if I access
controls on a page that was loaded directly by the framework from a URL,
controls are not null during Page_Load.

Is there anyway to achieve this? I have considered making the Bar ASPX into
a Control, but I dont want to have to do that at this stage if possible.

Thanks for any advice or guidance with this problem.

Nick.
 
S

Shiv Kumar

Have you looked at using the asp:placeholder control. You have two ways you
can do this using placeholder.
1. Create the controls dynamically each time
2. Make a UserControl and then add this UserControl to the placeholder at
run time.
 

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

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,053
Latest member
BrodieSola

Latest Threads

Top