Jore
Newcomer
Hi!
I use one sort of templating technique in asp.net. I have a single header and footer added before and after every content page in my development site.
Here is the the basepage class that builds the final page with header.ascx, content.aspx and footer.ascx:
In the header.ascx file I have a calendar control and two dropdownlists that submit values to different pages. And in the content (the actual aspx page) I have a datagrid control that needs to reside inside form tags with runat="server" set.
Here's the problem: I have a <form runat="server"> </form> tags in the header.ascx containing the controls. And I can't add another pair of form tags with the runat="server" option to the content pages. Nor can I begin the form in header and end in footer. Asp.net always gives out an error.
So How could I accomplish having working form elements in both header.ascx and content?
Btw. I am using webmatrix and therefore don't have the same ease in codeing the pages that visual studio users have. So If you have any suggestions please give them in a way that I can use without vs.
--Jore
I use one sort of templating technique in asp.net. I have a single header and footer added before and after every content page in my development site.
Here is the the basepage class that builds the final page with header.ascx, content.aspx and footer.ascx:
Code:
' BasePage.vb
Public Class BasePage : Inherits System.Web.UI.Page
Private _pageTitle As String
Public Property PageTitle() As String
Get
Return _pageTitle
End Get
Set(ByVal Value As String)
_pageTitle = Value
End Set
End Property
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
End Class
Public Class BaseControl : Inherits System.Web.UI.UserControl
Public Shadows ReadOnly Property Page() As BasePage
Get
Return CType(MyBase.Page, BasePage)
End Get
End Property
End Class
In the header.ascx file I have a calendar control and two dropdownlists that submit values to different pages. And in the content (the actual aspx page) I have a datagrid control that needs to reside inside form tags with runat="server" set.
Here's the problem: I have a <form runat="server"> </form> tags in the header.ascx containing the controls. And I can't add another pair of form tags with the runat="server" option to the content pages. Nor can I begin the form in header and end in footer. Asp.net always gives out an error.
So How could I accomplish having working form elements in both header.ascx and content?
Btw. I am using webmatrix and therefore don't have the same ease in codeing the pages that visual studio users have. So If you have any suggestions please give them in a way that I can use without vs.
--Jore
Last edited: