Programmatically setting the action attribute of the form tag

  • Thread starter Nathan Sokalski
  • 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.
 

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,755
Messages
2,569,537
Members
45,022
Latest member
MaybelleMa

Latest Threads

Top