Viewstate and runat=server forms

C

chris s.

I've got a problem concerning Server.Execute and the viewstate. It's
not a ViewStateMacEnabled=false problem as it happens - less of a
problem and more a question of 'is it possible'. I've got a main aspx
page which houses the layout html, and executes another .aspx file
using Server.Execute, this is then fed to a writer and finally
Response.Write'n.

My problem comes when putting a <form runat="server"> inside the child
page (the one to be executed) and having a viewstate. ASP.NET replaces
the action attribute value in the form tag with its own one, changing
it to the original page that the form tag is in (the page that is
Server.Execute'd).

This can be easily rectified with Javascript, however when the
executed page is posted, the parent page receives the viewstate info
(I assume), and it does nothing with it, and the page that is being
Server.Execute'd doesn't receieve it either.

Both pages make use of code behinds.

Does anyone know of a solution to this problem? The only alternative I
can think of is to use webcontrols, but that would be a real overkill
for what is being used. I have tried wrapping a <form runat=server>
before the Server.Execute, but then compiler sees the child page as
having no form runat=server and a compile error happens.

Thanks,
--Chris
 

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,754
Messages
2,569,522
Members
44,995
Latest member
PinupduzSap

Latest Threads

Top