asp:label width

Discussion in 'ASP .Net Datagrid Control' started by Robert, Jan 12, 2006.

  1. Robert

    Robert Guest

    I need to set the width of an asp:label at runtime based on the length of the
    data going into the cell of the grid. Below is my code:

    <asp:TemplateColumn HeaderText="Patient Name">
    <ItemTemplate>
    <asp:Label id="lblPatName" runat="server" width="150px"
    CssClass="standard-label" Text='<%# DataBinder.Eval(Container,
    "DataItem.pat_name") %>'>
    </asp:Label>
    </ItemTemplate>
    </asp:TemplateColumn>

    I need to set the width based on the length of the patients name. Is this
    possible?

    Thanks in Advance
    --
    Robert Hill
    Robert, Jan 12, 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. Shapper
    Replies:
    2
    Views:
    724
    Scott Mitchell [MVP]
    May 7, 2005
  2. Josef K.

    <label><div></div></label> allowed?

    Josef K., May 20, 2005, in forum: ASP .Net
    Replies:
    3
    Views:
    13,308
    Josef K.
    May 22, 2005
  3. AndrewF
    Replies:
    1
    Views:
    744
    Bruce Barker
    Oct 10, 2005
  4. Praveen
    Replies:
    1
    Views:
    947
    Rob Williscroft
    Nov 5, 2006
  5. Knut Krueger
    Replies:
    8
    Views:
    256
    Knut Krueger
    Aug 20, 2013
Loading...

Share This Page