Programmatically setting the action attribute of the form tag

  • Thread starter Thread starter Nathan Sokalski
  • Start date Start date
N

Nathan Sokalski

I need to programmatically set the action attribute of the form tag. First
of all, the ASP.NET form control does not have an action property (it shows
the Action attribute in source view, but not as a property in the code).
Because of this, I have been using the following to set it:

Me.form1.Attributes.Add("action", "http://www.mysite.com/file.aspx")

However, because ASP.NET posts back to itself by default, the generated code
still has

<form name="form1" method="post" action="currentpage.aspx" id="form1">

as the generated code. I thought that this might be because I needed to
place my code in a different event, but I am not sure what event I would
need to put it in because I am not sure what event the unwanted action is
getting set in. Any ideas? Thanks.
 
Back
Top