Server Controls in header file

  • Thread starter Thread starter Marcus Robinson
  • Start date Start date
M

Marcus Robinson

Hi,

I have files called header.ascx and footer.ascx which are included in pages
by a class that inherits System.Web.UI.Page and overides OnInit. See:
-------------------------
Protected Overrides Sub OnInit(ByVal e As System.EventArgs)

Me.Controls.AddAt(0, LoadControl("../header.ascx"))
MyBase.OnInit(e)
Me.Controls.Add(LoadControl("../footer.ascx"))

End Sub
--------------------------

I would like have a DropDownList server control (amongst others) in my
header. How can I achieve this. I am having problems with multiple form
tags and such like.

All help is much appreciated, if you need any more info please ask, thanks
in advance,

Marcus Robinson

The Programming Pages - http://www.programmingpages.com
Mr ICT Web Hosting - http://www.mrict.co.uk
 
Marcus,

You should never put form tags into a .ascx control. The only form tags
should be on the .aspx page itself. Then when you drop your control onto the
form it get's included inside of the .aspx page's form.

Sincerely,

--
S. Justin Gengo, MCP
Web Developer

Free code library at:
www.aboutfortunate.com

"Out of chaos comes order."
Nietzche
 
Back
Top