fitting label dimensions to length of string

Discussion in 'ASP .Net' started by Mike P, Nov 14, 2008.

  1. Mike P

    Mike P Guest

    I have a method that is returning a string which can be of any length.
    Once this string is returned I want to display it on screen in a label
    control. How can I make the label control's height and width be
    flexible so that it always fits the length of the string it contains?

    <asp:Label ID="lblSQL" runat="server" Height="600" Width="600"
    BackColor="blue" ForeColor="white" Font-Names="Verdana"
    Font-Size="Small"></asp:Label>

    protected void Page_Load(object sender, EventArgs e)
    {
    ViewState["CountGUID"] = Request.QueryString["GUID"];

    string strCountSQL =
    GetCountSql(ViewState["CountGUID"].ToString());

    lblSQL.Text = strCountSQL;
    }




    *** Sent via Developersdex http://www.developersdex.com ***
     
    Mike P, Nov 14, 2008
    #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. Mitchua
    Replies:
    5
    Views:
    2,777
    Eric J. Roode
    Jul 17, 2003
  2. Sam
    Replies:
    3
    Views:
    14,146
    Karl Seguin
    Feb 17, 2005
  3. =?Utf-8?B?R2VvZmYgQyBNZWxib3VybmU=?=

    Fitting lots of fields on one web page

    =?Utf-8?B?R2VvZmYgQyBNZWxib3VybmU=?=, May 27, 2005, in forum: ASP .Net
    Replies:
    3
    Views:
    524
    John Timney \(ASP.NET MVP\)
    May 30, 2005
  4. Replies:
    5
    Views:
    677
    John W. Kennedy
    Jan 11, 2007
  5. Knut Krueger
    Replies:
    8
    Views:
    296
    Knut Krueger
    Aug 20, 2013
Loading...

Share This Page