help with multiple forms on asp.net 1.1 page, please

  • Thread starter Thread starter simon
  • Start date Start date
S

simon

hello
i'm building a site that i want to include a user control on the top
of every page (basically a header/nav bar).
in that ascx there are a few vb objects (linkButtons, labels).
in order for them to be accessible to the codebehinds, i need to have
them wrapped in a form with runat=server on the form.

in the main body of the pages, just about every page is going to also
have a form on it, again with the runat=server parm.

then i get the "A page can have only one server-side Form tag"

is there anything i can do?

also in the ascx, i seem to have to make it a full html page because i
need to have a <head> section so that i can include the
<link href="style.css" type="text/css" rel="stylesheet"> line so that
i can access the css.

from what i read, the main page loads first, then the usercontrol page
loads. tried to exclude the <html> wrapper out of the control, but
that just made a mess of things. very stuck on these 2 topics.

help with these 2 topics would be very much appreciated as always!
 
kinda figured out some of my answers, hopefully this will help other
newbies...
turns out, you don't need to wrap vb.net elements in a form
runat=server tag. not sure what i did while coding, but did get an
error that in order for the page to recognize the element it needed to
in a form tag.
for the other question, if you put the css include and javascript
include in the "main" page head section it will be parsed and picked
up by the control. only downside is that in design mode of VS those
attributes won't be picked up, oh well...
thanks
 
If you go into the ASP code you might notice there is a Form1 element
wrapping the contents. Get rid of it. ASP Usercontrols (in VS2003 at least)
are not much more than an "Include." They're a bit underpowered and stupid.
 

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

Back
Top