如何在Asp.Net中创建GridView多列 [英] How to make GridView multicolumn in Asp.Net

查看:93
本文介绍了如何在Asp.Net中创建GridView多列的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



没有在GridView属性中设置列号的选项。

我的GridView只有一列,我怎么能使它成为多列?

更新:

解决方案

因为可能很难在Repeater中获得具有4列的表格,这里有一个示例。

 < table border =1> 
< tr>
< asp:Repeater ID =Repeater1runat =server>
< ItemTemplate>
<%#Container.ItemIndex%4 == 0&& Container.ItemIndex> 0? < / TR>< TR> 中:%>
< td><%#Eval(column)%>< / td>
< / ItemTemplate>
< / asp:中继器>
< / tr>
< / table>


My GridView in only single column, how can I make it multicolumn?

There isn't an option to set column number in GridView properties.

Update :

解决方案

Because it can be difficult to get a table with 4 columns in a Repeater, here a little example.

<table border="1">
    <tr>
        <asp:Repeater ID="Repeater1" runat="server">
            <ItemTemplate>
                <%# Container.ItemIndex %4 == 0 && Container.ItemIndex > 0 ? "</tr><tr>" : "" %>
                <td><%# Eval("column") %></td>
            </ItemTemplate>
        </asp:Repeater>
    </tr>
</table>

这篇关于如何在Asp.Net中创建GridView多列的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆