473,549 Members | 2,708 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 1332
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**********@g mail.com> wrote in message
news:11******** **************@ g44g2000cwa.goo glegroups.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****@inventi ve.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.W ebControls.* (you only use real value
added cases such as repeater, datagrid, etc.), you use :
System.Web.UI.H tmlControls.* . 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.co m> wrote in message
news:ud******** ******@TK2MSFTN GP12.phx.gbl...

"Roger Moore" <rm****@inventi ve.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.W ebControls.* (you only use real value
added cases such as repeater, datagrid, etc.), you use :
System.Web.UI.H tmlControls.* . 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
}

..altButtonForm at {
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****@inventi ve.com> wrote in message
news:O6******** ******@TK2MSFTN GP09.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**********@g mail.com> wrote in message
news:11******** **************@ g44g2000cwa.goo glegroups.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****@inventi ve.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.o detocode.com> wrote in message
news:kr******** *************** *********@4ax.c om...
On Fri, 7 Oct 2005 22:01:18 +0200, "Roger Moore"
<rm****@inventi ve.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
5334
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 re-iterate not a consitent error. Configuration Error Description: An error occurred during the processing of a configuration file required to...
4
2886
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 some textboxes not updating when i a hit save. for example I have this code in my aspx.cs file: declared:
3
2403
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 toolbox, I get the following error: There are no components in 'c:\windows\microsoft.net\framework\v1.1.4322\Microsoft.Web.UI.WebControls.d ll"...
1
4479
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: Server Error in '/application' Application. ---------------------------------------------------------------------------- ----
0
1491
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 up all that is returned to the web page is the buttons text and the contents of the DropDownlist. What am I doing wrong here? Below is the...
1
2441
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 this? The following is the detail error message: Configuration Error Description: An error occurred during the processing of a configuration file...
3
1910
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 the application to our webhost and an error came up:
2
3457
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 Gridview_rowdatabound, I am dynamically building hyperlink control based on the values in the other fields. Here is my code for Gridview_rowdatabound. It...
1
2304
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 Gridview_rowdatabound, I am dynamically building hyperlink control based on the values in the other fields. Here is my code for Gridview_rowdatabound. It...
0
1114
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 Namespace="Microsoft.Web.UI.WebControls" %> <%@ Register TagPrefix="ie" Namespace="Microsoft.Web.UI.WebControls" ...
0
7720
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
1
7475
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
7812
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
6048
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5372
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5089
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3501
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
1
1061
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
766
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.