다음
<asp:ListView ID="table" runat="server" ItemPlaceholderID="itemPlaceholder">
<LayoutTemplate>
<table>
<tr>
<th>
</th>
<th>
monday
</th>
<th>
tuesday
</th>
</tr>
<tr runat="server" id="itemPlaceholder" />
</table>
</LayoutTemplate>
<ItemTemplate>
<tr id="Tr1" runat="server">
<td>
<asp:Label ID="lblmon" runat="Server" Text='<%#Eval("monday") %>' />
</td>
<td>
<asp:Label ID="lbltues" runat="Server" Text='<%#Eval("tuesday") %>' />
</td>
</tr>
</ItemTemplate>
</asp:ListView>
와의
당신 vb.net 다음
ASCX에서
Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load
Dim table As New DataTable
' columns in the DataTable.
table.Columns.Add("Monday", System.Type.GetType("System.Int32"))
table.Columns.Add("Tuesday", System.Type.GetType("System.Int32"))
table.Columns.Add("Wednesday", System.Type.GetType("System.Int32"))
table.Columns.Add("Thursday", System.Type.GetType("System.Int32"))
table.Columns.Add("Friday", System.Type.GetType("System.Int32"))
' rows with those columns filled in the DataTable.
table.Rows.Add(1, 2005, 2000, 4000, 34)
table.Rows.Add(2, 3024, 2343, 2342, 12)
table.Rows.Add(3, 2320, 9890, 1278, 2)
table.Rows.Add(4, 3420, 1234, 4321, 89)
table.Rows.Add(5, 3240, 6600, 1100, 56)
table.Rows.Add(6, 4320, 1100, 3243, 23)
table.Rows.Add(7, 4540, 7645, 4324, 56)
Me.table.DataSource = table
Me.table.DataBind()
End Sub
는 방법이 코드를 넣어 호출 Page_Load에
Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load
BindData()
End Sub
Private Sub BindData()
Dim table As New DataTable
' columns in the DataTable.
table.Columns.Add("Monday", System.Type.GetType("System.Int32"))
table.Columns.Add("Tuesday", System.Type.GetType("System.Int32"))
table.Columns.Add("Wednesday", System.Type.GetType("System.Int32"))
table.Columns.Add("Thursday", System.Type.GetType("System.Int32"))
table.Columns.Add("Friday", System.Type.GetType("System.Int32"))
' rows with those columns filled in the DataTable.
table.Rows.Add(1, 2005, 2000, 4000, 34)
table.Rows.Add(2, 3024, 2343, 2342, 12)
table.Rows.Add(3, 2320, 9890, 1278, 2)
table.Rows.Add(4, 3420, 1234, 4321, 89)
table.Rows.Add(5, 3240, 6600, 1100, 56)
table.Rows.Add(6, 4320, 1100, 3243, 23)
table.Rows.Add(7, 4540, 7645, 4324, 56)
Me.table.DataSource = table
Me.table.DataBind()
End Sub
내 코드를 페이지에 배치하십시오. ID를 변경하고 테스트 웹 사이트에서 코드를 테스트 한 결과 작동합니다. – Mez
@ mali 당신이 관리 했습니까? – Mez
새 웹 사이트를 만들고 새 기본 페이지를 추가하고 내 .ASPX 및 .ASPX.VB를 각각 붙여 넣으십시오. 당신은 그것의 걸림 새를 아주 쉽게 잡아야한다. – Mez