Formatting a DataList ItemTemplate using CSS

Discussion in 'ASP .Net Web Controls' started by Nathan Sokalski, Oct 14, 2006.

  1. I have a DataList with the following ItemStyle and ItemTemplate:

    <ItemStyle VerticalAlign="Top"/>
    <ItemTemplate>
    <asp:Label ID="Label1" runat="server" Text="Label1" Width="300px"
    style="word-wrap:normal;"/>
    <asp:Label ID="Label2" runat="server" Text="Label2"
    style="float:left;word-wrap:break-word;"/>
    <asp:Button ID="Button1" runat="server" Text="Button1" style="float:right;"
    Width="125px"/>
    </ItemTemplate>

    I want the output to be similar to the following:

    Label1 Label2 Label2 Label2
    Label2 Label2 Button1
    Label2 Label2
    Label2 Label2 Label2
    Label2 Label2
    Label2 Label2 Label2
    Label2 Label2
    Label2 Label2 Label2
    Label2 Label2
    Label2

    What this is is a fixed-width label, a variable-width label that might wrap,
    and a button. I want the variable-width label to take up the space between
    the fixed-width label and the button, and I want the button to always be
    right-aligned. What would be the best way to do this in an asp:DataList's
    ItemTemplate? Thanks.
    --
    Nathan Sokalski

    http://www.nathansokalski.com/
    Nathan Sokalski, Oct 14, 2006
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Bennett Haselton
    Replies:
    1
    Views:
    5,321
    Joe Fallon
    Sep 24, 2004
  2. Charlie@CBFC
    Replies:
    0
    Views:
    377
    Charlie@CBFC
    May 17, 2006
  3. Charlie@CBFC
    Replies:
    2
    Views:
    527
    Charlie@CBFC
    May 18, 2006
  4. Nathan Sokalski

    Formatting a DataList ItemTemplate using CSS

    Nathan Sokalski, Oct 14, 2006, in forum: ASP .Net
    Replies:
    0
    Views:
    1,245
    Nathan Sokalski
    Oct 14, 2006
  5. Nathan Sokalski

    Formatting a DataList ItemTemplate using CSS

    Nathan Sokalski, Oct 14, 2006, in forum: ASP .Net Datagrid Control
    Replies:
    0
    Views:
    1,134
    Nathan Sokalski
    Oct 14, 2006
Loading...

Share This Page