如何使响应DataList控件asp.net [英] how to make Responsive DataList asp.net

查看:109
本文介绍了如何使响应DataList控件asp.net的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在我的网页的Asp.net DataList控件。它目前有repeatcolumns设置为4,这将给我4列,每列一行。但我想使这个响应和更小的屏幕尺寸将值设置为1。下面是我的asp.net控制:

I have an Asp.net DataList control in my page. It is currently having repeatcolumns set to 4 which will give me 4 columns in each row. But I want to make this responsive and set the value to 1 for smaller screen sizes. Below is my asp.net control:

<asp:DataList runat="server" RepeatDirection="Horizontal" RepeatColumns="4" ID="dd" class="vex-res">

我怎样才能做到这一点?

How can I achieve this?

推荐答案

您不能让DataList的积极回应,因为它呈现为表。

You cannot make DataList to be responsive, because it renders as Table.

相反,你需要使用的ListView 自举(或其他响应框架)。

Instead, you need to use ListView with bootstrap (or some other responsive framework).

<asp:ListView ID="ListView1" runat="server" ...>
    ...
    <ItemTemplate>
        <div class="row">
            <div class="col-md-4"><%# Eval("Name") %></div>
            <div class="col-md-4"><%# Eval("Email") %></div>
            <div class="col-md-4"><%# Eval("Address") %></div>
        </div>
    </ItemTemplate>
</asp:ListView>

这篇关于如何使响应DataList控件asp.net的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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