多维数祖数据绑定!
发表于:2007-06-30来源:作者:点击数:
标签:
html script language=C# runat=server void Page_Load(Object sender, EventArgs e) { // Create and populate a multi-dimensional array int [][] MyArray = new int[5][]; for (int i=0; i5; i++) { MyArray[i] = new int[6]; for (int x=0; x6; x++) { M
<html>
<script language="C#" runat=server>
void Page_Load(Object sender, EventArgs e) {
// Create and populate a multi-dimensional array
int [][] MyArray = new int[5][];
for (int i=0; i<5; i++) {
MyArray[i] = new int[6];
for (int x=0; x<6; x++) {
MyArray[i][x] = x+(6*i);
}
}
// Databind array to server controls
Outer.DataSource = MyArray;
Outer.DataBind();
}
</script>
<body>
<asp:datalist id="Outer" runat=server>
<template name="ItemTemplate">
Here is an array@#s values:
<asp:repeater datasource="<%#Container.DataItem%>" runat=server>
<template name="ItemTemplate">
<%# Container.DataItem %>
</template>
</asp:repeater>
</template>
</asp:datalist>
</body>
</html>
原文转自:http://www.ltesting.net