By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,656 Members | 1,009 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,656 IT Pros & Developers. It's quick & easy.

ASP.NET label control not wrapping text in non-IE browsers

P: n/a
Hello all,
I have ASP.NET label controls tied to a datasource (so
text will vary in length depending on the record). In IE
everything looks great--text is wrapped if needed. In
Netscape and Opera, the text extends horizontally and does
not wrap.

Any ideas would be most appreciated!

Thanks,
Mike
Nov 18 '05 #1
Share this Question
Share on Google+
7 Replies


P: n/a
Have you set the width of the label? Labels render as SPAN tags in the
resulting HTML and if you have specified a width, that will appear as an
inline style attribute of the SPAN tag. If this does not work in a browser,
then that browser does not support CSS.
"Mike Casey" <an*******@discussions.microsoft.com> wrote in message
news:01****************************@phx.gbl...
Hello all,
I have ASP.NET label controls tied to a datasource (so
text will vary in length depending on the record). In IE
everything looks great--text is wrapped if needed. In
Netscape and Opera, the text extends horizontally and does
not wrap.

Any ideas would be most appreciated!

Thanks,
Mike

Nov 18 '05 #2

P: n/a
Thanks! I specify the width and height directly in the
HTML view of the page. I've noticed that making this
change within the "Style" parameters (HEIGHT: 42px; WIDTH:
100px;) works temporarily. However after recompiling the
application, the height and width attributes appear again
outside the Style tag (I assume this is because they are
set in the property window / Design view of the server
control).

I'm thinking of removing them from the properties window
and also resorting to a pure HTML control rather than a
server-based Web control, but I'm struggling with why I
have to do this.

Thanks again!
Mike
-----Original Message-----
Have you set the width of the label? Labels render as SPAN tags in theresulting HTML and if you have specified a width, that will appear as aninline style attribute of the SPAN tag. If this does not work in a browser,then that browser does not support CSS.
"Mike Casey" <an*******@discussions.microsoft.com> wrote in messagenews:01****************************@phx.gbl...
Hello all,
I have ASP.NET label controls tied to a datasource (so
text will vary in length depending on the record). In IE everything looks great--text is wrapped if needed. In
Netscape and Opera, the text extends horizontally and does not wrap.

Any ideas would be most appreciated!

Thanks,
Mike

.

Nov 18 '05 #3

P: n/a

"Mike Casey" <an*******@discussions.microsoft.com> wrote in message
news:07****************************@phx.gbl...
Thanks! I specify the width and height directly in the
HTML view of the page. I've noticed that making this
change within the "Style" parameters (HEIGHT: 42px; WIDTH:
100px;) works temporarily. However after recompiling the
application, the height and width attributes appear again
outside the Style tag (I assume this is because they are
set in the property window / Design view of the server
control).

Not sure what you mean here. You can easily just set the width of the label
in the properties window while the page is open in design view. There's no
need to code it yourself in the HTML view.

I'm thinking of removing them from the properties window
and also resorting to a pure HTML control rather than a
server-based Web control, but I'm struggling with why I
have to do this.

Thanks again!
Mike
-----Original Message-----
Have you set the width of the label? Labels render as

SPAN tags in the
resulting HTML and if you have specified a width, that

will appear as an
inline style attribute of the SPAN tag. If this does not

work in a browser,
then that browser does not support CSS.
"Mike Casey" <an*******@discussions.microsoft.com> wrote

in message
news:01****************************@phx.gbl...
Hello all,
I have ASP.NET label controls tied to a datasource (so
text will vary in length depending on the record). In IE everything looks great--text is wrapped if needed. In
Netscape and Opera, the text extends horizontally and does not wrap.

Any ideas would be most appreciated!

Thanks,
Mike

.

Nov 18 '05 #4

P: n/a
I'm thinking there might be a reason in this case. If you
make changes in the properties window, the Width and
Height parameters appear by themselves in HTML, outside of
the Style tag. I'm thinking that some browsers might not
recognize these values unless they are within the Style
tag. Maybe?
-----Original Message-----

"Mike Casey" <an*******@discussions.microsoft.com> wrote in messagenews:07****************************@phx.gbl...
Thanks! I specify the width and height directly in the
HTML view of the page. I've noticed that making this
change within the "Style" parameters (HEIGHT: 42px; WIDTH: 100px;) works temporarily. However after recompiling the application, the height and width attributes appear again outside the Style tag (I assume this is because they are
set in the property window / Design view of the server
control).

Not sure what you mean here. You can easily just set the

width of the labelin the properties window while the page is open in design view. There's noneed to code it yourself in the HTML view.

I'm thinking of removing them from the properties window
and also resorting to a pure HTML control rather than a
server-based Web control, but I'm struggling with why I
have to do this.

Thanks again!
Mike
>-----Original Message-----
>Have you set the width of the label? Labels render as

SPAN tags in the
>resulting HTML and if you have specified a width, that

will appear as an
>inline style attribute of the SPAN tag. If this does not
work in a browser,
>then that browser does not support CSS.
>
>
>"Mike Casey" <an*******@discussions.microsoft.com>
wrote in message
>news:01****************************@phx.gbl...
>> Hello all,
>> I have ASP.NET label controls tied to a datasource
(so >> text will vary in length depending on the record). In IE
>> everything looks great--text is wrapped if needed.

In >> Netscape and Opera, the text extends horizontally and

does
>> not wrap.
>>
>> Any ideas would be most appreciated!
>>
>> Thanks,
>> Mike
>
>
>.
>

.

Nov 18 '05 #5

P: n/a
I'm not sure you are following my instructions or you may have a problem
with your VS installation.

If I put a label on a webform and then change its height and width
properties in the property window and then run the project, I get the
following HTML sent to my client:

<span id="Label1" style="height:75px;width:100px">Label</span>

Note that the height and width are attribute values for the style attribute
of the span tag. This is the correct behavior. I'm not sure what you mean
by the parameters appearing by themselves in HTML outside of the style tag,
but if you are not getting the same results as I'm showing above, then
something is wrong.
"Mike Casey" <an*******@discussions.microsoft.com> wrote in message
news:08****************************@phx.gbl...
I'm thinking there might be a reason in this case. If you
make changes in the properties window, the Width and
Height parameters appear by themselves in HTML, outside of
the Style tag. I'm thinking that some browsers might not
recognize these values unless they are within the Style
tag. Maybe?
-----Original Message-----

"Mike Casey" <an*******@discussions.microsoft.com> wrote

in message
news:07****************************@phx.gbl...
Thanks! I specify the width and height directly in the
HTML view of the page. I've noticed that making this
change within the "Style" parameters (HEIGHT: 42px; WIDTH: 100px;) works temporarily. However after recompiling the application, the height and width attributes appear again outside the Style tag (I assume this is because they are
set in the property window / Design view of the server
control).


Not sure what you mean here. You can easily just set the

width of the label
in the properties window while the page is open in design

view. There's no
need to code it yourself in the HTML view.

I'm thinking of removing them from the properties window
and also resorting to a pure HTML control rather than a
server-based Web control, but I'm struggling with why I
have to do this.

Thanks again!
Mike
>-----Original Message-----
>Have you set the width of the label? Labels render as
SPAN tags in the
>resulting HTML and if you have specified a width, that
will appear as an
>inline style attribute of the SPAN tag. If this does not work in a browser,
>then that browser does not support CSS.
>
>
>"Mike Casey" <an*******@discussions.microsoft.com> wrote in message
>news:01****************************@phx.gbl...
>> Hello all,
>> I have ASP.NET label controls tied to a datasource (so >> text will vary in length depending on the record). In IE
>> everything looks great--text is wrapped if needed. In >> Netscape and Opera, the text extends horizontally and
does
>> not wrap.
>>
>> Any ideas would be most appreciated!
>>
>> Thanks,
>> Mike
>
>
>.
>

.

Nov 18 '05 #6

P: n/a
AH...actually that is the HTML label you are adding,
right? If I add the Web Forms Label control, the tags are
handled differently...
-----Original Message-----
I'm not sure you are following my instructions or you may have a problemwith your VS installation.

If I put a label on a webform and then change its height and widthproperties in the property window and then run the project, I get thefollowing HTML sent to my client:

<span id="Label1" style="height:75px;width:100px">Label</span>
Note that the height and width are attribute values for the style attributeof the span tag. This is the correct behavior. I'm not sure what you meanby the parameters appearing by themselves in HTML outside of the style tag,but if you are not getting the same results as I'm showing above, thensomething is wrong.
"Mike Casey" <an*******@discussions.microsoft.com> wrote in messagenews:08****************************@phx.gbl...
I'm thinking there might be a reason in this case. If you make changes in the properties window, the Width and
Height parameters appear by themselves in HTML, outside of the Style tag. I'm thinking that some browsers might not recognize these values unless they are within the Style
tag. Maybe?
>-----Original Message-----
>
>"Mike Casey" <an*******@discussions.microsoft.com> wrote
in message
>news:07****************************@phx.gbl...
>> Thanks! I specify the width and height directly in
the >> HTML view of the page. I've noticed that making this
>> change within the "Style" parameters (HEIGHT: 42px;

WIDTH:
>> 100px;) works temporarily. However after recompiling

the
>> application, the height and width attributes appear

again
>> outside the Style tag (I assume this is because they are >> set in the property window / Design view of the server >> control).
>>
>
>Not sure what you mean here. You can easily just set the width of the label
>in the properties window while the page is open in
design view. There's no
>need to code it yourself in the HTML view.
>
>
>> I'm thinking of removing them from the properties
window >> and also resorting to a pure HTML control rather than a >> server-based Web control, but I'm struggling with why I >> have to do this.
>>
>> Thanks again!
>> Mike
>> >-----Original Message-----
>> >Have you set the width of the label? Labels render as >> SPAN tags in the
>> >resulting HTML and if you have specified a width, that >> will appear as an
>> >inline style attribute of the SPAN tag. If this does not
>> work in a browser,
>> >then that browser does not support CSS.
>> >
>> >
>> >"Mike Casey" <an*******@discussions.microsoft.com>

wrote
>> in message
>> >news:01****************************@phx.gbl...
>> >> Hello all,
>> >> I have ASP.NET label controls tied to a datasource

(so
>> >> text will vary in length depending on the record).

In
>> IE
>> >> everything looks great--text is wrapped if needed.

In
>> >> Netscape and Opera, the text extends horizontally

and >> does
>> >> not wrap.
>> >>
>> >> Any ideas would be most appreciated!
>> >>
>> >> Thanks,
>> >> Mike
>> >
>> >
>> >.
>> >
>
>
>.
>

.

Nov 18 '05 #7

P: n/a
No, that is the Web Form Label (System.Web.UI.WebControls.Label).

All web form controls render in the client as HTML, so the web form label
control renders as a span tag. Any modifications to the look/feel/position
of the label in the properties window render as style attribute values to
the span tag.

Let's see what HTML you are getting in your browser if you use a web form
label.
"Mike Casey" <an*******@discussions.microsoft.com> wrote in message
news:05****************************@phx.gbl...
AH...actually that is the HTML label you are adding,
right? If I add the Web Forms Label control, the tags are
handled differently...
-----Original Message-----
I'm not sure you are following my instructions or you may

have a problem
with your VS installation.

If I put a label on a webform and then change its height

and width
properties in the property window and then run the

project, I get the
following HTML sent to my client:

<span id="Label1"

style="height:75px;width:100px">Label</span>

Note that the height and width are attribute values for

the style attribute
of the span tag. This is the correct behavior. I'm not

sure what you mean
by the parameters appearing by themselves in HTML outside

of the style tag,
but if you are not getting the same results as I'm

showing above, then
something is wrong.
"Mike Casey" <an*******@discussions.microsoft.com> wrote

in message
news:08****************************@phx.gbl...
I'm thinking there might be a reason in this case. If you make changes in the properties window, the Width and
Height parameters appear by themselves in HTML, outside of the Style tag. I'm thinking that some browsers might not recognize these values unless they are within the Style
tag. Maybe?
>-----Original Message-----
>
>"Mike Casey" <an*******@discussions.microsoft.com> wrote in message
>news:07****************************@phx.gbl...
>> Thanks! I specify the width and height directly in the >> HTML view of the page. I've noticed that making this
>> change within the "Style" parameters (HEIGHT: 42px;
WIDTH:
>> 100px;) works temporarily. However after recompiling
the
>> application, the height and width attributes appear
again
>> outside the Style tag (I assume this is because they are >> set in the property window / Design view of the server >> control).
>>
>
>Not sure what you mean here. You can easily just set the width of the label
>in the properties window while the page is open in design view. There's no
>need to code it yourself in the HTML view.
>
>
>> I'm thinking of removing them from the properties window >> and also resorting to a pure HTML control rather than a >> server-based Web control, but I'm struggling with why I >> have to do this.
>>
>> Thanks again!
>> Mike
>> >-----Original Message-----
>> >Have you set the width of the label? Labels render as >> SPAN tags in the
>> >resulting HTML and if you have specified a width, that >> will appear as an
>> >inline style attribute of the SPAN tag. If this does not
>> work in a browser,
>> >then that browser does not support CSS.
>> >
>> >
>> >"Mike Casey" <an*******@discussions.microsoft.com>
wrote
>> in message
>> >news:01****************************@phx.gbl...
>> >> Hello all,
>> >> I have ASP.NET label controls tied to a datasource
(so
>> >> text will vary in length depending on the record).
In
>> IE
>> >> everything looks great--text is wrapped if needed.
In
>> >> Netscape and Opera, the text extends horizontally and >> does
>> >> not wrap.
>> >>
>> >> Any ideas would be most appreciated!
>> >>
>> >> Thanks,
>> >> Mike
>> >
>> >
>> >.
>> >
>
>
>.
>

.

Nov 18 '05 #8

This discussion thread is closed

Replies have been disabled for this discussion.