Solved

asp.net - not allowed to increase the width of a WebControls.Label inside a HtmlTable cell

Posted on 2008-10-20
4
442 Views
Last Modified: 2012-05-05
The problem is shown in the attached screen shot.

The problem is that the label that i have selected wont span the length of the table. The annoying thing about this is that it USED to, but for some reason one day i loaded the project and it shortened itself and now i cant make it bigger.

You can see by the properties there is no explicitly set Width of the label, and that the text wraps itsself because the label size is somehow set to a fixed value.

What causes this and how can i fix it?
problem.JPG
0
Comment
Question by:tfsln
  • 2
4 Comments
 
LVL 8

Expert Comment

by:mkosbie
ID: 22762166
Is there some CSS set on it perhaps?  Try removing the style properties and any CSS class to see if it spans properly.  If so, then add them back one by one until you find the culprit.
0
 

Author Comment

by:tfsln
ID: 22762214
Where it used to say <td class="style28"> it now just says <td>.
It fixed it, but is it possible to cause any other issues? I dont use stylesheets in my application, but i notice that every other row has a style except this one now... (and they all work fine)
0
 
LVL 8

Accepted Solution

by:
mkosbie earned 500 total points
ID: 22762254
Whatever IDE your using probably is creating stylesheets for some of your formatting in the background.  Look in the head section of you code for a style element similar to this:

<style type="text/css">
<!--
// various style declarations
.style28 {
    width: 15px; //some width
    //other declarations on this style
}
-->
</style>

Find the line that has width in it for style28 and delete it, then put the class back so any other formatting you have will work.  If that doesn't help, or you don't see a width line, past style28 here and we'll look at it.
0
 
LVL 16

Expert Comment

by:GreymanMSC
ID: 22762294
To force the label to fit the width of the containing cell, simply set the Width attribute to 100%.

<table id=AnExample>

  <tr valign=top>

    <td style="border-color:red;border-style:solid;border-width:thin" 

       width=200px

    ><asp:Label ID=Elle runat=server 

        BorderColor=Blue BorderStyle=Solid BorderWidth=2px 

        Text="Hello World" 

        Width=100%

       ></asp:Label></td>

  </tr>

</table>    

Open in new window

0

Featured Post

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

For those of you who don't follow the news, or just happen to live under rocks, Microsoft Research released a beta SDK (http://www.microsoft.com/en-us/download/details.aspx?id=27876) for the Xbox 360 Kinect. If you don't know what a Kinect is (http:…
Today I had a very interesting conundrum that had to get solved quickly. Needless to say, it wasn't resolved quickly because when we needed it we were very rushed, but as soon as the conference call was over and I took a step back I saw the correct …
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now