ASP.Net messes with my form's action attributes!

G

Guest

I have a form tag in my page (Metadata.aspx) as belo

<form id="Form1" method="post" runat="server" action="Metadata.aspx"

My problem is that when this page is accessed from other pages which pass parameters in the query string to Metadata.aspx these are then reflected in the form's action attribute so it looks like this..

<form name="Form1" method="post" action="MetaData.aspx?Param1=2&amp;Param2=z" language="javascript" onsubmit="ValidatorOnSubmit();" id="Form1"

I have tried using

((HtmlForm)Page.FindControl("Form1")).Attributes.Add("action","Metadata.aspx") to override this behaviour but to no avail

Any ideas how I can turn this behaviour off?

Cheers

Marti
 
K

Kevin Spencer

A WebForm (runat=server) will always post back to itself. To create a form
that does not, it can't be a WebForm.

--
HTH,
Kevin Spencer
..Net Developer
Microsoft MVP
Big things are made up
of lots of little things.

Martin said:
I have a form tag in my page (Metadata.aspx) as below

<form id="Form1" method="post" runat="server" action="Metadata.aspx">

My problem is that when this page is accessed from other pages which pass
parameters in the query string to Metadata.aspx these are then reflected in
the form's action attribute so it looks like this...
<form name="Form1" method="post"
action="MetaData.aspx?Param1=2&amp;Param2=z" language="javascript"
onsubmit="ValidatorOnSubmit();" id="Form1">
I have tried using
((HtmlForm)Page.FindControl("Form1")).Attributes.Add("action","Metadata.aspx
") to override this behaviour but to no avail.
 
G

Guest

Cheers

That's quite disappointing.

I would have expected a way to change this behaviour!
 

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,769
Messages
2,569,580
Members
45,055
Latest member
SlimSparkKetoACVReview

Latest Threads

Top