Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

FORMs in ASP.NET Apps

Status
Not open for further replies.

WiseNewbie

Programmer
Jan 9, 2004
45
0
0
AU
Hi,

Is this a bug or is this normal? I cannot use forms in ASP.NET Applications because of the initial form tag? I want to enable a search site area on each page(in hte footer.ascx file) and while i can include it, when i submit it the page doesnt do anything(post information out)

What can i do to avoid this?
 
Hi Wise

Not sure what you mean here? You can only have one server form in an asp.net page. This is a limitation of the current veriosn of ASP.NET

By server form I mean a HTML form tag with the attribute runat="server" e.g.
Code:
<form id=&quot;MyForm&quot; runat=&quot;server&quot;>
You can howver add additonal client forms to add search style functionality to your footer. if you have a form tag like this..
Code:
<form id=&quot;SearchForm&quot; action=&quot;search.aspx&quot; method=&quot;POST&quot;>
<input type=&quot;text&quot; name=&quot;searchterm&quot; />
<input type=&quot;submit&quot; />
</form>
included in your page. When the submit button is clicked it will have the effect of posting your form to the recieving page specified in the action as on a standard web page.

You can capture the form data using
Code:
Request.Form[&quot;searchterm&quot;]
in your code-behind for the search page and do your processing to return a result set...

Hope this helps

Rob

Go placidly amidst the noise and haste, and remember what peace there may be in silence - Erhmann 1927
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top