asp.net数据列表-更改样式 [英] asp.net datalist - change styling

查看:126
本文介绍了asp.net数据列表-更改样式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

<asp:DataList ID="ItemsList" RepeatDirection="Vertical" runat="server">            
  <ItemTemplate>                  
        <asp:LinkButton 
            ID="SecondLevelItem" runat="server"  CommandName="second" 
            OnCommand="SecondLevelItem_Onclick" CommandArgument="<%# Container.DataItem %>" 
            Text="<%# Container.DataItem %>" >  
        </asp:LinkButton>                                     
    </ItemTemplate>            
 </asp:DataList>

一切正常。除了我对项目样式没有任何控制之外。我的意思是我在外部具有数据列表上的样式,但我想在每个项目之间(垂直)添加一些间距。我该怎么办?谢谢

everything works fine. except that I do not have any control over the styling on the items. I mean I have the styling on the datalist externally but I want to add some spacing (vertically) between each item. How do I do tht? Thanks

推荐答案

通常,要控制样式,您可以应用< ItemStyle> < asp:DataList> 内的c $ c>标记。

In general, to control style, you can apply the <ItemStyle> tag inside the <asp:DataList>.

您可以选择将CSS属性注入到asp:LinkBut​​ton标签,可以使用 class 属性,也可以直接使用样式来控制高度或其他CSS属性。

You can optionally inject CSS properties into the asp:LinkButton tag, either with the class attribute or directly with style, controlling the height or other CSS properties.

如果适用,您仍然可以在模板的底部添加
(但这也会在最后一项上添加垂直空间,我不知道是否要添加它。)

If it's applicable, you can still add a
on the bottom of the template (but this will add a vertical space to the last item too, and I don't know if you want it).

希望能对您有所帮助。

这篇关于asp.net数据列表-更改样式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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