Home All Groups Group Topic Archive Search About

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

Author
4 Feb 2006 11:58 PM
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!

Author
5 Feb 2006 2:58 AM
simon
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

On Sat, 04 Feb 2006 18:58:40 -0500, simon <m*@here.com> wrote:

Show quoteHide quote
>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!
Author
5 Feb 2006 3:10 AM
CMM
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.

Show quoteHide quote
"simon" <m*@here.com> wrote in message
news:ecfau1lgmk935e3sfdtv1qgbdriab6k3ik@4ax.com...
> 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!
>