textbox control styles not added for Mozilla

T

Tony Brand

Hi,
Is there a way to force .NET to add styles to controls to display
properties as set in the VS.NET designer? I'm using Visual Studio.NET
2002, and therefore 1.0 .NET framework.

For example, I've created a page that has a textbox control with its
width set in the VS.NET designer. When the page is displayed in IE6 it
has the style added to the input field to display it how I wanted:

<input name="LeftMenu:txtMiniAge" type="text" maxlength="3"
id="LeftMenu_txtMiniAge" style="width:34px;" />

However when I view the same page in the latest Mozilla the styles
aren't added and I get:

<input name="LeftMenu:txtMiniAge" type="text" maxlength="3"
id="LeftMenu_txtMiniAge" />

In fact I'm not getting styles added to any controls in Mozilla unless I
explicitly set them in the code behind file, eg:

txtMiniAge.Style.Add("width", "34px")

Its much easier to set the properties in the designer and I'd rather not
have to add code to set them twice. If I only set them in the code
behind then the designer view doesn't look right.

Any ideas?

Tony
 
M

Meena Desai

Hi,

U can make CSSClass file for ur application , make a new class in it as per
ur requirement and use it for ur textbox.

Meena.
 
T

Tony Brand

Meena said:
Hi,

U can make CSSClass file for ur application , make a new class in it as per
ur requirement and use it for ur textbox.

Meena.

Hi Meena,
I had considered that but I've inherited a site that doesn't display
properly in some browsers and I guess I'm looking for an easy solution.
So rather than go through and set CSS classes I just wondered if I could
get .NET to add the relevent styles it already has.

Thanks for the suggestion.

Regards
Tony
 
H

Hans Kesting

Tony said:
Hi,
Is there a way to force .NET to add styles to controls to display
properties as set in the VS.NET designer? I'm using Visual Studio.NET
2002, and therefore 1.0 .NET framework.

For example, I've created a page that has a textbox control with its
width set in the VS.NET designer. When the page is displayed in IE6 it
has the style added to the input field to display it how I wanted:

<input name="LeftMenu:txtMiniAge" type="text" maxlength="3"
id="LeftMenu_txtMiniAge" style="width:34px;" />

However when I view the same page in the latest Mozilla the styles
aren't added and I get:

<input name="LeftMenu:txtMiniAge" type="text" maxlength="3"
id="LeftMenu_txtMiniAge" />

In fact I'm not getting styles added to any controls in Mozilla unless I
explicitly set them in the code behind file, eg:

txtMiniAge.Style.Add("width", "34px")

Its much easier to set the properties in the designer and I'd rather not
have to add code to set them twice. If I only set them in the code
behind then the designer view doesn't look right.

Any ideas?

Tony

Maybe you need to look into "browser caps", to have asp.net
treat Mozilla as "up level" browser.
 
T

Tony Brand

Hans said:
Maybe you need to look into "browser caps", to have asp.net
treat Mozilla as "up level" browser.
Hi Hans, this looks very promising, thank you.

Tony
 
B

bruce barker

add this code to onload:

if ("netscape|gecko|opera".IndexOf (this.Request.Browser.Browser.ToLower())
this.ClientTarget = "Uplevel";

-- bruce (sqlwork.com)


| Hi,
| Is there a way to force .NET to add styles to controls to display
| properties as set in the VS.NET designer? I'm using Visual Studio.NET
| 2002, and therefore 1.0 .NET framework.
|
| For example, I've created a page that has a textbox control with its
| width set in the VS.NET designer. When the page is displayed in IE6 it
| has the style added to the input field to display it how I wanted:
|
| <input name="LeftMenu:txtMiniAge" type="text" maxlength="3"
| id="LeftMenu_txtMiniAge" style="width:34px;" />
|
| However when I view the same page in the latest Mozilla the styles
| aren't added and I get:
|
| <input name="LeftMenu:txtMiniAge" type="text" maxlength="3"
| id="LeftMenu_txtMiniAge" />
|
| In fact I'm not getting styles added to any controls in Mozilla unless I
| explicitly set them in the code behind file, eg:
|
| txtMiniAge.Style.Add("width", "34px")
|
| Its much easier to set the properties in the designer and I'd rather not
| have to add code to set them twice. If I only set them in the code
| behind then the designer view doesn't look right.
|
| Any ideas?
|
| Tony
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,770
Messages
2,569,584
Members
45,077
Latest member
SangMoor21

Latest Threads

Top