resizing asp label control

Last post 05-09-2008 5:29 PM by joeydood. 6 replies.

Sort Posts:

  • resizing asp label control

    05-06-2008, 10:10 PM
    • Loading...
    • joeydood
    • Joined on 05-07-2008, 1:59 AM
    • Posts 5

    does anyone have a clue how to resize a label control on a web page?  i can't believe i have to ask this with over 25 years of coding sheesh...

     vs 2008 'web developer'

    by the way, what's up with the password requirements on the site, ya'll gots nuclear bomb codes on here or something???  hell its just a forum...
    what a royal pain in the arse.  i had to open my iron key where i keep all my passwords, share the damn folder and edit it on another computer that has office installed on it and save it there because i had to make up some gibberish password with numbers and special freaking characters in it.

    now that i've made it in here do i get the special decoder ring?

    anyway, any help on the resizing label issue would be most appreciated.  it's quite aggravating...

    thanks,
    jp
  • Re: resizing asp label control

    05-07-2008, 12:07 AM
    • Loading...
    • Mojtaabaa
    • Joined on 04-29-2008, 6:54 AM
    • ایران
    • Posts 35

    you can use its width and hight or use css.what is your problem?describe more if it diesn't help you 

    شرکت فناوران اطلاعات وستا
    ارائه کننده نرم افزار آموزش مجازي؛نرم افزار استاديار؛نرم افزار کتابخانه؛نرم افزار کتابخانه ديجيتال؛نرم
    افزار آموزش الکترونيک
    نرم افزار آموزش از راه دور
    شرکت فناوران اطلاعات وستا
  • Re: resizing asp label control

    05-07-2008, 10:12 AM
    • Loading...
    • joeydood
    • Joined on 05-07-2008, 1:59 AM
    • Posts 5

    sorry, i double-posted. i didn't know posts had to be approved before appearing.

     moderators, please delete this post.

    original post is here:

    http://forums.asp.net/t/1257618.aspx

     

    thanks!

    thanks,
    jp
  • Re: resizing asp label control

    05-07-2008, 12:09 PM
    Answer

    Label is a <span> element and span elements do not have width according to W3C standard. IE6/7 does render width on spans, but FireFox does not. You can change inline element ti block element by setting style="display:block" and then width will apply (this will change span behavior to be div element effectively).

    If you are trying to align textboxes that are to the right of labels to the same position, using simple table will be most efficient:

    <table>

    <tr><td><asp:label ...></td><td><asp:textbox ...></td></tr>

    <tr><td><asp:label ...></td><td><asp:textbox ...></td></tr>

    ...

    <table>

     

    Thanks

    ------------------------------------------------------------

    This posting is provided "AS IS" with no warranties, and confers no rights.
  • Re: resizing asp label control

    05-08-2008, 6:37 PM
    • Loading...
    • stmarti
    • Joined on 06-06-2006, 12:20 PM
    • Posts 539

    If you set AssociatedControlID for asp:label you get a rendered label control, so the width will work.

    If you don't set AssociatedControlID, you get a span element (this is quite stupid, and there are many complains about this from years)

    If you need to manipulate a label in code behind you can also use this:

    <label id="abc" runat="server" for="yourcontrolid">Some text</label>, to set some text in code behind: abc.InnerText="something";

  • Re: resizing asp label control

    05-09-2008, 2:58 PM
    • Loading...
    • joeydood
    • Joined on 05-07-2008, 1:59 AM
    • Posts 5

    eh, this isn't even worth discussing really.  sorry to have wasted anyone's time.

     all i'm doing writing validation for the checkboxlist control for which the standard validation controls will not work.  maybe i'm missing something about validation.  i might know a lot but i don't know everything - guess its time for a refresher class on asp coding.

     thanks anyway!

    --jp

    thanks,
    jp
  • Re: resizing asp label control

    05-09-2008, 5:29 PM
    • Loading...
    • joeydood
    • Joined on 05-07-2008, 1:59 AM
    • Posts 5

    well, i figured it out.  the big problem is that the checkboxlist controls are inside of a container which uses a master page.

    for some reason (i guess i am retarted?) encapsulating the solution in a dll and using the register directive in the aspx file would not work due to the content/master.  yes, i tried the 2 dudes from rolla dll answer - i'm sure that solution is OK if you don't have a content/master situation or maybe it does and i'm just ignorant of how to do that.  but it validates checkboxlist controls like a champ.

    oh, and the label controls do not wrap text like they were doing before.  super easy, i just had to quit listening to ac/dc and put on some iron maiden.

    so, the entire solution is in the aspx.vb file.

    can i mark my own post as the answer?

    thanks,
    jp
Page 1 of 1 (7 items)