나는 페이지의 거의 모든 것을 생성하는 코드 인 웹 사이트를 운영하고 있습니다. 홈 페이지는 코드를 통해 빌드되는 오른쪽 메뉴로 구성됩니다. System.Web.UI.WebControls.TableCell 클래스를 사용하고 모든 새 항목에 대해 td를 만듭니다.System.Web.UI.WebControls.TableCell에 대체
Public Sub BuildMainMenuStructure(ByVal Cell As TableCell, _
ByVal Contents As DataTable, _
ByVal ReadMode As Boolean, _
ByVal CurrentPage As String, _
ByVal RecSecurity As ApplicationRoleSecurity, _
ByVal SourcePageRef As Integer, _
ByVal IncludeMyIntranetPanel As Boolean)
'-----------------------------------------------------------------
'Div1 Contents
'-----------------------------------------------------------------
'Set up the contents in a div (panel) called pnlMainMenu1
Dim mmContents As New MainMenuContents
mmContents.ID = "pcaMainMenuContents"
mmContents.SetControl(Contents, _
ReadMode, _
CurrentPage, _
RecSecurity, _
SourcePageRef)
mintContentsCount = mmContents.Count
Dim pnlMainMenu1 As New Panel
With pnlMainMenu1
.ID = "pcaMainMenuContentsPanel"
'By default, this panel is visible:
.Style.Add("visibility", "visible")
.Controls.Add(mmContents)
End With
코드의 다른 영역에서 홈의 상이한 부분이 생성된다 :
If IncludeMyIntranetPanel And ReadMode Then
'Set up the contents in a div (panel) called pnlMainMenu2
Dim mmMyIntranet As New MainMenuMyIntranet
mmMyIntranet.ID = "pcaMainMenuMyIntranet"
mmMyIntranet.SetControl(Contents, _
ReadMode, _
CurrentPage, _
RecSecurity, _
SourcePageRef)
Dim pnlMainMenu2 As New Panel
With pnlMainMenu2
.ID = "pcaMainMenuMyIntranetPanel"
'By default, this panel is visible:
.Style.Add("visibility", "visible")
.Controls.Add(mmMyIntranet)
End With
'Add it to the cell:
Cell.Controls.Add(pnlMainMenu2)
End If 'End If IncludeMyIntranetPanel
그것 Cell.Controls 통해 콘텐츠를 추가 여기
코드의 단편이다. 추가 (pnlMainMenu2)홈 페이지를 다시 스킨으로 지정해야합니다. 이상적으로는 콘텐츠를 쉽게 배치 할 수 있도록 DIV 클래스를 생성하려고합니다.
데이터베이스의 데이터를 가져 와서 div 클래스를 만들 수있는 .net 클래스가 있습니까?
나는 약간 말씨가되었지만, 필자는 다시 말해야한다고 생각합니다. Panel 컨트롤이나 리터럴 컨트롤에는 데이터베이스 인터랙션이 내장되어 있습니다. 데이터베이스 작업을하고 코드 숨김을 통해 출력을 추가해야합니다. 또한 Panel 컨트롤은 실제로 TableCell과 달리 텍스트를 가져 오지 않습니다. 예, DIV를 출력하지만 실제로 텍스트를 출력하려면 Label 또는 HyperLink 등 컨트롤을 추가해야합니다. –
제가 작업하고있는 사이트의 문제점은 모든 것이 데이터베이스/코드 생성이라는 것을보십시오. 나는 개발자가 실제로 스타일 시트를 알고 있다고 생각하지 않는다! 홈 페이지를 "다시 스키닝 (re-skinning)"하는 것에 대한 이야기가 있지만, "물건"의 많은 부분이 계속 이어 지므로 홈 페이지를 새로운 디자인으로 스키닝하는 경우는 아닙니다. –