Option Explicit On 
Option Strict On
Option Compare Text

Imports System.Data.SqlClient

Public MustInherit Class ParentPageInfo
	Inherits System.Web.UI.UserControl
	Protected WithEvents lnkParentPageTitle As System.Web.UI.WebControls.LinkButton
	Protected WithEvents lblParentID As System.Web.UI.WebControls.Label
	Protected WithEvents lblParentHeading As System.Web.UI.WebControls.Label
	Protected WithEvents daParentPage As System.Data.SqlClient.SqlDataAdapter
	Protected WithEvents cmdPP_Select As System.Data.SqlClient.SqlCommand
	Protected WithEvents DsParentPage1 As AllSaints.dsParentPage
	Protected WithEvents Conn As System.Data.SqlClient.SqlConnection
	Protected WithEvents daViewChildPages As System.Data.SqlClient.SqlDataAdapter
	Protected WithEvents cmdVCP_Select As System.Data.SqlClient.SqlCommand
	Protected WithEvents DsViewChildPages1 As AllSaints.dsViewChildPages
	Protected WithEvents dlSubPages As System.Web.UI.WebControls.DataList

#Region " Web Form Designer Generated Code "

	'This call is required by the Web Form Designer.
	<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
		Me.daParentPage = New System.Data.SqlClient.SqlDataAdapter()
		Me.cmdPP_Select = New System.Data.SqlClient.SqlCommand()
		Me.DsParentPage1 = New AllSaints.dsParentPage()
		Me.Conn = New System.Data.SqlClient.SqlConnection()
		Me.daViewChildPages = New System.Data.SqlClient.SqlDataAdapter()
		Me.cmdVCP_Select = New System.Data.SqlClient.SqlCommand()
		Me.DsViewChildPages1 = New AllSaints.dsViewChildPages()
		CType(Me.DsParentPage1, System.ComponentModel.ISupportInitialize).BeginInit()
		CType(Me.DsViewChildPages1, System.ComponentModel.ISupportInitialize).BeginInit()
		'
		'daParentPage
		'
		Me.daParentPage.SelectCommand = Me.cmdPP_Select
		Me.daParentPage.TableMappings.AddRange(New System.Data.Common.DataTableMapping() {New System.Data.Common.DataTableMapping("Table", "GetPageInfo", New System.Data.Common.DataColumnMapping() {New System.Data.Common.DataColumnMapping("ID", "ID"), New System.Data.Common.DataColumnMapping("PageName", "PageName"), New System.Data.Common.DataColumnMapping("Body", "Body"), New System.Data.Common.DataColumnMapping("BodyHeading", "BodyHeading"), New System.Data.Common.DataColumnMapping("TopPicture", "TopPicture"), New System.Data.Common.DataColumnMapping("RightPicture", "RightPicture"), New System.Data.Common.DataColumnMapping("ParentID", "ParentID")})})
		'
		'cmdPP_Select
		'
		Me.cmdPP_Select.CommandText = "[GetPageInfo]"
		Me.cmdPP_Select.CommandType = System.Data.CommandType.StoredProcedure
		Me.cmdPP_Select.Parameters.Add(New System.Data.SqlClient.SqlParameter("@RETURN_VALUE", System.Data.SqlDbType.Int, 4, System.Data.ParameterDirection.ReturnValue, False, CType(10, Byte), CType(0, Byte), "", System.Data.DataRowVersion.Current, Nothing))
		Me.cmdPP_Select.Parameters.Add(New System.Data.SqlClient.SqlParameter("@PageID", System.Data.SqlDbType.Int, 4, System.Data.ParameterDirection.Input, False, CType(10, Byte), CType(0, Byte), "", System.Data.DataRowVersion.Current, Nothing))
		'
		'DsParentPage1
		'
		Me.DsParentPage1.DataSetName = "dsParentPage"
		Me.DsParentPage1.Locale = New System.Globalization.CultureInfo("en-US")
		Me.DsParentPage1.Namespace = "http://www.tempuri.org/dsParentPage.xsd"
		'
		'Conn
		'
		Me.Conn.ConnectionString = "data source=localhost;initial catalog=allsaints;persist security info=False;user " & _
		"id=sa;workstation id=GALAXY;packet size=4096"
		'
		'daViewChildPages
		'
		Me.daViewChildPages.SelectCommand = Me.cmdVCP_Select
		Me.daViewChildPages.TableMappings.AddRange(New System.Data.Common.DataTableMapping() {New System.Data.Common.DataTableMapping("Table", "GetChildPages", New System.Data.Common.DataColumnMapping() {New System.Data.Common.DataColumnMapping("ID", "ID"), New System.Data.Common.DataColumnMapping("PageName", "PageName"), New System.Data.Common.DataColumnMapping("Body", "Body"), New System.Data.Common.DataColumnMapping("BodyHeading", "BodyHeading"), New System.Data.Common.DataColumnMapping("TopPicture", "TopPicture"), New System.Data.Common.DataColumnMapping("RightPicture", "RightPicture"), New System.Data.Common.DataColumnMapping("ParentID", "ParentID")})})
		'
		'cmdVCP_Select
		'
		Me.cmdVCP_Select.CommandText = "[GetChildPages]"
		Me.cmdVCP_Select.CommandType = System.Data.CommandType.StoredProcedure
		Me.cmdVCP_Select.Connection = Me.Conn
		Me.cmdVCP_Select.Parameters.Add(New System.Data.SqlClient.SqlParameter("@RETURN_VALUE", System.Data.SqlDbType.Int, 4, System.Data.ParameterDirection.ReturnValue, False, CType(10, Byte), CType(0, Byte), "", System.Data.DataRowVersion.Current, Nothing))
		Me.cmdVCP_Select.Parameters.Add(New System.Data.SqlClient.SqlParameter("@PageID", System.Data.SqlDbType.Int, 4, System.Data.ParameterDirection.Input, False, CType(10, Byte), CType(0, Byte), "", System.Data.DataRowVersion.Current, Nothing))
		'
		'DsViewChildPages1
		'
		Me.DsViewChildPages1.DataSetName = "dsViewChildPages"
		Me.DsViewChildPages1.Locale = New System.Globalization.CultureInfo("en-US")
		Me.DsViewChildPages1.Namespace = "http://www.tempuri.org/dsViewChildPages.xsd"
		CType(Me.DsParentPage1, System.ComponentModel.ISupportInitialize).EndInit()
		CType(Me.DsViewChildPages1, System.ComponentModel.ISupportInitialize).EndInit()

	End Sub

	Private Sub Page_Init(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Init
		'CODEGEN: This method call is required by the Web Form Designer
		'Do not modify it using the code editor.
		InitializeComponent()
	End Sub

#End Region
	Dim _ParentID As Integer
	Public Property ParentID() As Integer
		Get
			Return _ParentID
		End Get
		Set(ByVal intValue As Integer)
			_ParentID = intValue
		End Set
	End Property

	Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
		If Not Page.IsPostBack Then

			'get the parent pages details
			daParentPage.SelectCommand.Parameters("@PageID").Value = _ParentID
			daParentPage.Fill(DsParentPage1)

			'get the parent's child pages to be binded against dlSubPages
			daViewChildPages.SelectCommand.Parameters("@PageID").Value = _ParentID
			daViewChildPages.Fill(DsViewChildPages1)

			'Page.DataBind()
		End If
	End Sub

End Class
