Solved

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

Posted on 2008-10-20
4
447 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Stressed Out?

Watch some penguins on the livecam!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

IntroductionWhile developing web applications, a single page might contain many regions and each region might contain many number of controls with the capability to perform  postback. Many times you might need to perform some action on an ASP.NET po…
More often than not, we developers are confronted with a need: a need to make some kind of magic happen via code. Whether it is for a client, for the boss, or for our own personal projects, the need must be satisfied. Most of the time, the Framework…
This is a high-level webinar that covers the history of enterprise open source database use. It addresses both the advantages companies see in using open source database technologies, as well as the fears and reservations they might have. In this…
In this video, viewers will be given step by step instructions on adjusting mouse, pointer and cursor visibility in Microsoft Windows 10. The video seeks to educate those who are struggling with the new Windows 10 Graphical User Interface. Change Cu…

705 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