Reference to form ???
-
Hello, In my CodeBehind, how can i get reference to the form tag with attritute runat="server" ???. For example, in my aspx file, i have a form below:
the question is that how can i get reference to this form to set the attritute action="onepage.aspx" at run time ? I cant do that before. Thanks for yr replying.
-
Hello, In my CodeBehind, how can i get reference to the form tag with attritute runat="server" ???. For example, in my aspx file, i have a form below:
the question is that how can i get reference to this form to set the attritute action="onepage.aspx" at run time ? I cant do that before. Thanks for yr replying.
You use the HTMLForm class to get access to the
element. But you can't set the action property from code-behind. You can use either Response.Redirect or Server.Transfer. HTH, -Thea-
-
You use the HTMLForm class to get access to the
element. But you can't set the action property from code-behind. You can use either Response.Redirect or Server.Transfer. HTH, -Thea-
I'd suggest the
Server.Transfer
, but it all depends on what you need.Server.Transfer
sends the request directly to the targetted page, instead of going back to the user and then to the next page. Michael Flanakin Web Log -
I'd suggest the
Server.Transfer
, but it all depends on what you need.Server.Transfer
sends the request directly to the targetted page, instead of going back to the user and then to the next page. Michael Flanakin Web Logthanks for your answer. My friend give me the way to resolve that. By using Javascript, we can rewrite the action value of the form as below:
function RewriteAction() { document.Form1.action = "onepage.aspx"; }
and when the click event of the button (OnClick event) occur, the function will be called and it will do rewrite the action value.