Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP.NET label control not wrapping text in non-IE browsers

Reply
Thread Tools

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

 
 
Mike Casey
Guest
Posts: n/a
 
      12-17-2003
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
 
Reply With Quote
 
 
 
 
Scott M.
Guest
Posts: n/a
 
      12-17-2003
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" <(E-Mail Removed)> wrote in message
news:01db01c3c4e3$fbf91050$(E-Mail Removed)...
> 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



 
Reply With Quote
 
 
 
 
Mike Casey
Guest
Posts: n/a
 
      12-18-2003
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 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" <(E-Mail Removed)> wrote

in message
>news:01db01c3c4e3$fbf91050$(E-Mail Removed)...
>> 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

>
>
>.
>

 
Reply With Quote
 
Scott M.
Guest
Posts: n/a
 
      12-18-2003

"Mike Casey" <(E-Mail Removed)> wrote in message
news:07d701c3c568$5bef0e90$(E-Mail Removed)...
> 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" <(E-Mail Removed)> wrote

> in message
> >news:01db01c3c4e3$fbf91050$(E-Mail Removed)...
> >> 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

> >
> >
> >.
> >



 
Reply With Quote
 
Mike Casey
Guest
Posts: n/a
 
      12-19-2003
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" <(E-Mail Removed)> wrote

in message
>news:07d701c3c568$5bef0e90$(E-Mail Removed)...
>> 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" <(E-Mail Removed)>

wrote
>> in message
>> >news:01db01c3c4e3$fbf91050$(E-Mail Removed)...
>> >> 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
>> >
>> >
>> >.
>> >

>
>
>.
>

 
Reply With Quote
 
Scott M.
Guest
Posts: n/a
 
      12-19-2003
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" <(E-Mail Removed)> wrote in message
news:085101c3c635$2e826650$(E-Mail Removed)...
> 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" <(E-Mail Removed)> wrote

> in message
> >news:07d701c3c568$5bef0e90$(E-Mail Removed)...
> >> 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" <(E-Mail Removed)>

> wrote
> >> in message
> >> >news:01db01c3c4e3$fbf91050$(E-Mail Removed)...
> >> >> 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
> >> >
> >> >
> >> >.
> >> >

> >
> >
> >.
> >



 
Reply With Quote
 
Mike Casey
Guest
Posts: n/a
 
      12-19-2003
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" <(E-Mail Removed)> wrote

in message
>news:085101c3c635$2e826650$(E-Mail Removed)...
>> 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" <(E-Mail Removed)>

wrote
>> in message
>> >news:07d701c3c568$5bef0e90$(E-Mail Removed)...
>> >> 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" <(E-Mail Removed)>

>> wrote
>> >> in message
>> >> >news:01db01c3c4e3$fbf91050$(E-Mail Removed)...
>> >> >> 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
>> >> >
>> >> >
>> >> >.
>> >> >
>> >
>> >
>> >.
>> >

>
>
>.
>

 
Reply With Quote
 
Scott M.
Guest
Posts: n/a
 
      12-19-2003
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" <(E-Mail Removed)> wrote in message
news:05f301c3c64b$66e0ef10$(E-Mail Removed)...
> 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" <(E-Mail Removed)> wrote

> in message
> >news:085101c3c635$2e826650$(E-Mail Removed)...
> >> 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" <(E-Mail Removed)>

> wrote
> >> in message
> >> >news:07d701c3c568$5bef0e90$(E-Mail Removed)...
> >> >> 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" <(E-Mail Removed)>
> >> wrote
> >> >> in message
> >> >> >news:01db01c3c4e3$fbf91050$(E-Mail Removed)...
> >> >> >> 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
> >> >> >
> >> >> >
> >> >> >.
> >> >> >
> >> >
> >> >
> >> >.
> >> >

> >
> >
> >.
> >



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
label wrapping rodchar ASP .Net 2 12-03-2007 03:23 PM
dll config and web.config and Label Expressions (binding label text to dll config settings) CSharpner ASP .Net 0 04-09-2007 09:00 PM
Two Browsers work! Two browsers won't load. Internet game service won't load jimmie Computer Support 1 02-26-2006 08:36 AM
asp:label not wrapping KJ ASP .Net Web Controls 1 06-24-2004 09:11 PM
Line wrapping with WebForm Label =?Utf-8?B?bWc=?= ASP .Net 1 01-19-2004 04:16 PM



Advertisments