Solved

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

Posted on 2008-10-20
4
445 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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

In my previous two articles we discussed Binary Serialization (http://www.experts-exchange.com/A_4362.html) and XML Serialization (http://www.experts-exchange.com/A_4425.html). In this article we will try to know more about SOAP (Simple Object Acces…
ASP.Net to Oracle Connectivity Recently I had to develop an ASP.NET application connecting to an Oracle database.As I am doing it first time ,I had to solve several problems. This article will help to such developers  to develop an ASP.NET client…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…

829 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