473,407 Members | 2,315 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,407 software developers and data experts.

CSS to webcontrols

Hi all,

I have a beginner's question:

If webcontrols are rendered to suit different browsers using different HTML
syntax for each, how can I create a unified CSS stylesheet to them (using
the cssStyle attribute).

What I say is that I need to know which HTML tag i'm applying the style to,
in order to know which CSS styles are relevant to it.

Thanks in advance,
Roger.
Nov 19 '05 #1
7 1329
you can apply a style to an element type, class or id like this:

input
{
font-family:Tahoma;
}

this would apply the Tahoma font to all "<input..." elements

..MyClass
{
font-size:70%;
}

this would apply a font-size of 70% to all html elements with
class="MyClass" attribute

#MyId
{
margin:0px;
}

this would apply a margin of 0px to all elements with id="MyId"
attribute

you can also nest styles, like this:

#MyTable th
{
font-weight:bold;
}

this would apply a bold font to all "<th>" elements for the item with
id="MyTable"

HTH

Neil

Nov 19 '05 #2
Thanks for answering, but I'm afraid you didn't understand my question:
ASP.NET renders webcontrols as different HTML tags for different HTML
versions, browsers etc. so when I apply a cssStyle to an ASP.NET webcontrol
I don't know if I'm actually applying it to INPUT, TEXTAREA or whatever HTML
tag ASP.NET chooses to use for my <asp:textbox/> (I take this tag only as an
example - other tags may use a broad variety of other interchanging HTML
tags) control.

I hope I made myself clear this time.. thanks again..

<ne**********@gmail.com> wrote in message
news:11**********************@g44g2000cwa.googlegr oups.com...
you can apply a style to an element type, class or id like this:

input
{
font-family:Tahoma;
}

this would apply the Tahoma font to all "<input..." elements

.MyClass
{
font-size:70%;
}

this would apply a font-size of 70% to all html elements with
class="MyClass" attribute

#MyId
{
margin:0px;
}

this would apply a margin of 0px to all elements with id="MyId"
attribute

you can also nest styles, like this:

#MyTable th
{
font-weight:bold;
}

this would apply a bold font to all "<th>" elements for the item with
id="MyTable"

HTH

Neil

Nov 19 '05 #3

"Roger Moore" <rm****@inventive.com> a écrit dans le message de news:
Of**************@TK2MSFTNGP09.phx.gbl...
Hi all,

I have a beginner's question:

If webcontrols are rendered to suit different browsers using different
HTML syntax for each, how can I create a unified CSS stylesheet to them
(using the cssStyle attribute).

What I say is that I need to know which HTML tag i'm applying the style
to, in order to know which CSS styles are relevant to it.


Simple : you avoid System.Web.UI.WebControls.* (you only use real value
added cases such as repeater, datagrid, etc.), you use :
System.Web.UI.HtmlControls.* . This also gives you a good chance of
achieving Firefox compatibility (once you have updated your browsercaps).

Nov 19 '05 #4
Thanks Michael,

I understand you recommend using repeater - that's was my default, but I
really do want to use some of the more complex .NET webcontrols.
You've mentioned datagrid: how do I know which set of HTML tags are involved
when .NET renders this tag (on all browsers that is)?.. it's easy to assume
it only uses table tags (TD, TR, TBODY etc) - but how can I make sure that,
for exampe, it won't stick a SPAN to one of the TDs?

Thanks,
Roger.
"Michel de Becdelièvre" <m_*****@msn.com> wrote in message
news:ud**************@TK2MSFTNGP12.phx.gbl...

"Roger Moore" <rm****@inventive.com> a écrit dans le message de news:
Of**************@TK2MSFTNGP09.phx.gbl...
Hi all,

I have a beginner's question:

If webcontrols are rendered to suit different browsers using different
HTML syntax for each, how can I create a unified CSS stylesheet to them
(using the cssStyle attribute).

What I say is that I need to know which HTML tag i'm applying the style
to, in order to know which CSS styles are relevant to it.


Simple : you avoid System.Web.UI.WebControls.* (you only use real value
added cases such as repeater, datagrid, etc.), you use :
System.Web.UI.HtmlControls.* . This also gives you a good chance of
achieving Firefox compatibility (once you have updated your browsercaps).


Nov 19 '05 #5
Example.

<style type="text/css">
<!--
INPUT {
background-color: #99ccff;
color: black;
font-family: arial, verdana, ms sans serif;
font-weight: bold;
font-size: 12pt
}

TEXTAREA {
background-color: navy;
border: black 2px solid;
color: white;
font-family: arial, verdana, ms sans serif;
font-size: 12pt;
font-weight: normal
}

..altButtonFormat {
background-color: #c0c0c0;
font-family: verdana;
border: #000000 1px solid;
font-size: 12px;
color: #778899
}

..altTextField {
background-color: #ececec;
font-family: verdana;
font-size: 12pt;
color: #09c09c
}

..radioStyle {
background-color: #FF0000;
border: #000000 solid 1px;
font-family: verdana;
font-size: 12px;
color: #000000
}
-->

"Roger Moore" <rm****@inventive.com> wrote in message
news:O6**************@TK2MSFTNGP09.phx.gbl...
Thanks for answering, but I'm afraid you didn't understand my question:
ASP.NET renders webcontrols as different HTML tags for different HTML
versions, browsers etc. so when I apply a cssStyle to an ASP.NET
webcontrol I don't know if I'm actually applying it to INPUT, TEXTAREA or
whatever HTML tag ASP.NET chooses to use for my <asp:textbox/> (I take
this tag only as an example - other tags may use a broad variety of other
interchanging HTML tags) control.

I hope I made myself clear this time.. thanks again..

<ne**********@gmail.com> wrote in message
news:11**********************@g44g2000cwa.googlegr oups.com...
you can apply a style to an element type, class or id like this:

input
{
font-family:Tahoma;
}

this would apply the Tahoma font to all "<input..." elements

.MyClass
{
font-size:70%;
}

this would apply a font-size of 70% to all html elements with
class="MyClass" attribute

#MyId
{
margin:0px;
}

this would apply a margin of 0px to all elements with id="MyId"
attribute

you can also nest styles, like this:

#MyTable th
{
font-weight:bold;
}

this would apply a bold font to all "<th>" elements for the item with
id="MyTable"

HTH

Neil


Nov 19 '05 #6
On Fri, 7 Oct 2005 22:01:18 +0200, "Roger Moore"
<rm****@inventive.com> wrote:

If webcontrols are rendered to suit different browsers using different HTML
syntax for each, how can I create a unified CSS stylesheet to them (using
the cssStyle attribute).


This is a tough question to answer. On one hand it's nice to work with
server controls because they present a higher level of abstraction.
Someday we will think of HTML as a primitive assembly language for the
web.

In 2.0 we have skin files, which are a server-side type of stylesheet,
but as I'm sure someone will point out, not a standard. Nevertheless,
they make it easy to manage and style the complex server side controls
like DataViews and Calendars.

I've written a bit about Themes and Skins here:

http://www.odetocode.com/Articles/423.aspx
http://odetocode.com/Blogs/scott/arc...9/01/2144.aspx

--
Scott
http://www.OdeToCode.com/blogs/scott/
Nov 19 '05 #7
Thanks,

But since I'm using 1.1, it's back to "good old HTML" for me when creating
user controls..
Fortunately enough, I am not really required for one of the datagrid (etc.)
fancy functionalities in my app.

"Scott Allen" <sc***@nospam.odetocode.com> wrote in message
news:kr********************************@4ax.com...
On Fri, 7 Oct 2005 22:01:18 +0200, "Roger Moore"
<rm****@inventive.com> wrote:

If webcontrols are rendered to suit different browsers using different
HTML
syntax for each, how can I create a unified CSS stylesheet to them (using
the cssStyle attribute).


This is a tough question to answer. On one hand it's nice to work with
server controls because they present a higher level of abstraction.
Someday we will think of HTML as a primitive assembly language for the
web.

In 2.0 we have skin files, which are a server-side type of stylesheet,
but as I'm sure someone will point out, not a standard. Nevertheless,
they make it easy to manage and style the complex server side controls
like DataViews and Calendars.

I've written a bit about Themes and Skins here:

http://www.odetocode.com/Articles/423.aspx
http://odetocode.com/Blogs/scott/arc...9/01/2144.aspx

--
Scott
http://www.OdeToCode.com/blogs/scott/

Nov 19 '05 #8

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Chuck Farah | last post by:
I keep getting this error running a VB .NET web forms application. I exit visual studio kill the aspnet_wp.exe process and restart vs and works again. Any help would be appreciated. Just to...
4
by: Rodrigo DeJuana | last post by:
Howdy, I'm new to this .net stuff and really have little to no training. Im trying to create a new page for a web form, so i have been pretty much jsut coping code. I having some issue with...
3
by: CW | last post by:
I have downloaded, built and installed iewebcontrols. I tested the sample application and everything worked just fine. However, when I attempt to add Microsoft.Web.UI.WebControls.dll to the VS.Net...
1
by: KMart | last post by:
Hello, I have a ASP.NET/C# application that uses the IE Web Controls. Everything was working fine. Then, for some unknown reason, everything stopped working. Here's the error information: ...
0
by: I am Sam | last post by:
Ok whats wrong with my toolbar? When I debug I don't get an error message and the databinding is working correctly but the toolbar itself and the <iewc:ToolbarDropDownlist /> control isn't showing...
1
by: Lorenc | last post by:
Recently I am getting this error randomly while working with visual studio ..NET 2003 on a C# project and browsing my application. Everything comes to normal after rebooting. Can someone help on...
3
by: dave | last post by:
We have an application that works perfectly in-house (tested on 3 different servers). It uses Microsoft.Web.UI.WebControls.dll for menubars and toolbars. Problem Description: We uploaded...
2
by: loga123 | last post by:
Hi All, I am using Link Button for DELETE on the gridview. When I click on DELETE link, I get the ArgumentOutOfRangeException. But...it deletes the record from table in the database. On...
1
by: loga123 | last post by:
Hi All, I am using Link Button for DELETE on the gridview. When I click on DELETE link, I get the ArgumentOutOfRangeException. But...it deletes the record from table in the database. On...
0
by: marcyb | last post by:
Can anyone help I am trying to get a WebControl toolbar to work this is my code for a toolbar in visual web developement 2005 express for C# <%@ Page Language="C#" Debug="true" %> <%@ Import...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.