?
Solved

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

Posted on 2008-10-20
4
Medium Priority
?
448 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 2000 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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Just a quick little trick I learned recently.  Now that I'm using jQuery with abandon in my asp.net applications, I have grown tired of the following syntax:      (CODE) I suppose it just offends my sense of decency to put inline VBScript on a…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…
Suggested Courses

770 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