Multi-browser appearance problem

G

Guest

I'm expiriencing a basic HTML appearance problem with ASP.NET. Following a
couple of sample tags to ilustrate my problem:

<asp:TextBox id="txtWidthIssue" runat="server" Width="100"></asp:TextBox>
<asp:DropDownList id="ddlWidthIssue" runat="server"
Width="100"></asp:DropDownList>

Browser like Firefox and I'll imagine many others are not sizing correctly
the controls (.net is removing the with property during the rendering). I
tried to use STYLE="WIDTH: 100px" instead of the Width property, and is doing
the resizing fine in Firefox, but, since STYLE is not natural to the server
controls, every time I do something on the designer, .NET removes the STYLE.

This is just a basic sample, I'm having all type of problems. I was under
the impression that ASP.NET was going to render the appropriate HTML for the
browser requesting the page, if that's right how should I use that
functionality? That functionality includes my basic sample WIDTH?

I'm seriously thinking to create a web custom controls layer to add some
functionality to the basic controls, but before start on that, I'll like to
know if there is a shortcut for this problem, using the current controls.


Thanks in advance
 
J

John Saunders

Luis Fajardo said:
I'm expiriencing a basic HTML appearance problem with ASP.NET. Following
a
couple of sample tags to ilustrate my problem:

<asp:TextBox id="txtWidthIssue" runat="server" Width="100"></asp:TextBox>
<asp:DropDownList id="ddlWidthIssue" runat="server"
Width="100"></asp:DropDownList>

Browser like Firefox and I'll imagine many others are not sizing correctly
the controls (.net is removing the with property during the rendering).

I can't speak to your particular issue, but you might try using a stylesheet
and then using the CssClass property on the web controls.

John Saunders
 
G

Guest

What I'm trying to specify is the WIDTH of the controls, using .css is going
to be difficult since the WIDTH is not standard for all controls.

Thanks for your comment
 
J

John Saunders

Luis Fajardo said:
What I'm trying to specify is the WIDTH of the controls, using .css is
going
to be difficult since the WIDTH is not standard for all controls.

style="width:100px" isn't standard for all controls? I didn't know that.
Which ones does it not work with?

John
 
G

Guest

Johh, style="width: 100px" is standard, but what is happening is that if you
try to specify that to your <asp:TextBox> or <asp:DropDownList> controls the
..NET designer REMOVES the style attribute from your controls, I think,
because the style attribute is not available as part of the standard
properties for these controls.

In the other hand, if you use the Width property, in Firefox browser and I
believe that also in Netscape, the rendering process REMOVES the Width clause
on those browsers, and what happen is that you textbox and dropdownlist are
display with NO WIDTH at all, letting the browser set a default size, too
bad!!!!

Give it a try! Unless I'm smoking something :)


I think that I hear that there is a way to manipulate the RENDERING process
to avoid these problems, but I don't remember. Any ideas?


Thanks in advance,
Luis
 
J

John Saunders

Luis Fajardo said:
Johh, style="width: 100px" is standard, but what is happening is that if
you
try to specify that to your <asp:TextBox> or <asp:DropDownList> controls
the
.NET designer REMOVES the style attribute from your controls, I think,
because the style attribute is not available as part of the standard
properties for these controls.

I said that you should try creating a stylesheet and referring to the
classes in the stylesheet with the CssClass attribute on the web controls.
That will not be removed.

John
 

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,766
Messages
2,569,569
Members
45,042
Latest member
icassiem

Latest Threads

Top