By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,963 Members | 924 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,963 IT Pros & Developers. It's quick & easy.

Viewstate and runat=server forms

P: n/a
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

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

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.

Nov 18 '05 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.