views:

11

answers:

2
<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

A: 

In the code behind databound method for the list, you may be able to add a css class via the attributes collection.

In fact you may be able to that declartively too, just checking now...

eg asp:DataList id="blah" runat="server" ItemStyle-CssClass="someClass"

brumScouse
A: 

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

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).

Hope to have been of help.

djechelon