Link to home
Start Free TrialLog in
Avatar of gfody
gfodyFlag for United States of America

asked on

override form action in asp.net web control runat=server

for my asp.net project I have a template file (default.aspx) that takes a page parameter to execute inside it. so every file on my server I access thru default.aspx so that it is loaded with the right borders/graphics around it. for example a link would look like  http://.../default.aspx?myinfo.aspx

default.aspx gets loaded and does its stuff, then calls server.execute(myinfo.aspx) and the end result is myinfo all dressed up. this method has been working great for a while, even post backs are fine (I just set action="default.aspx?mypage.aspx"). but I've recently ran into a problem.

the problem is with the asp.net web controls. they make a form with runat="server" and no action, when they postback they post directly to the page, bypassing my default.aspx template. when I try to specify an action its ignored. can anybody help me with a solution to this problem? really if I could just override the action for the web control everything would work perfectly - but its not working. please help!
ASKER CERTIFIED SOLUTION
Avatar of naveenkohli
naveenkohli

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of gfody

ASKER

thanks for the suggestion. its not really a solution though as my default.aspx template is in use for the rest of site (and working nicely). when I'm using my own forms I specify default.aspx?mypage.aspx as the action and the postback works perfectly.. the problem with the .net controls is that its not letting me specify the action and posts back to mypage.aspx directly. If I could just override the action somehow it would work fine.

another reason that I need the default.aspx?mypage... functionality is that the entire site can be "skinned" to have a different look just by modifying default.aspx
Avatar of naveenkohli
naveenkohli

Unfortunately this behavior is by design. all postbacks happen to current page only.
As far as skining or getting a common look for all pages goes, you can divide your default page into deifferent sections. And then each section can be a usercontrol or template control. And when a page needs to be generated based on the QueryString, you can pass that to the template. And that template generate output based on that value.
No comment has been added lately and it seems that this question have been abandoned. So it's time to clean up this TA.

I will leave a recommendation in the Cleanup topic area that this question or invite a Moderator to close this question if there's no reply from you after seven days.

In the absence of responses, I will recommend the following:

To accept the comment and points awarded to naveenkohli

** PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER **


Just trying to help for the cleanup...
gladxml