Form trouble

R

Roshawn

Hi,

I have a web page that contains an html form and has a few controls in it. The html form and its controls are all server
controls. However, I've set the enableViewState attribute of the html form and its controls to false as I can get this data
from the querystring and set appropriate form values via code.

When I perform a postback, the form's action attribute gets set by ASP.NET. No biggie there as it was designed to do just
that. However, when I make changes to the controls in the html form (i.e. set different search parameters) nothing changes.
Here's an example: First I set these parameters on the form

Search.aspx?keyword=hat&price=10&size=2

I then press the button on the form and perform a postback. The form's action attribute looks just like the above. But when
I change the parameters of my search like this:

Search.aspx?keyword=headband&price=5&size=1

and press the button, I get the same results as the original search. I've checked my code to see if I've made any errors but
found none. Then I right-click the page and select View Source to have a look at what's there. To my dismay, the html
form's action attribute is still set to this:

Search.aspx?keyword=hat&price=10&size=2


No matter how many times I make changes to the parameters of the search and post the page back, the form's action attribute
is still the same value. I can't change it for the life of me.

What's the problem? It's been three days already and I'm running out of hair (been pulling it out). Any help would be
greatly appreciated.

Thanks,
Roshawn


P.S. This page is a content page. Perhaps this could be the issue but I can't see it.
 
G

Gaurav Vaish \(MasterGaurav\)

Form's action is set when the form is first loaded.
It will never change... the method is always post and that's what matters.
 
B

bruce barker

change the method to a get if you wat the form vriables on the url, or
look in the form collection rather than the querystring collection

-- bruce (sqlwork.com)
 
R

Roshawn

Gaurav said:
Form's action is set when the form is first loaded.
It will never change... the method is always post and that's what matters.

Hmm, I wasn't aware of that. Thanks for the heads-up. :)

Roshawn
 
R

Roshawn

bruce said:
change the method to a get if you wat the form vriables on the url, or
look in the form collection rather than the querystring collection

-- bruce (sqlwork.com)

Are you saying that I can "set" the method property of an html form to "GET"? I thought that property was always set to
"POST" on a form created as a server control.

Hopefully, this could work.

Thanks again,
Roshawn
 

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

Forum statistics

Threads
473,780
Messages
2,569,608
Members
45,241
Latest member
Lisa1997

Latest Threads

Top