首页 > 开发 > 综合 > 正文

多维数祖数据绑定!

2024-07-21 02:22: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; 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>


收集最实用的网页特效代码!

发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表