473,586 Members | 2,776 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

how does Style class work?

I have create Style class instance and set up properties like this:

Style st = new Style();
st.BackColor = Color.Black;
st.BorderColor = Color.White;
st.BorderStyle = BorderStyle.Sol id;
st.BorderWidth = new Unit(1, UnitType.Pixel) ;

string styleStr = string.format(" this.style.cssT ext='{0}', st.ToString());

cell.Attributes .Add("onmouseov er", styleStr);
But st.ToString() seems to always return "" (string.empty). I want to return something like 'background-Color=Black; ... " text.

How the Style() class work and how i can do what i want?
Nov 18 '05 #1
4 1301
I see you want to apply the style on client side. The easiest way of doing
this is like this:

1. Attach the style "MyStyle" to your page, either in the page header or in
a separate file.
2. cell.Attributes .Add("onmouseov er", "className='MyS tyle'");

Eliyahu

and then change className property on the client side.
"terrorix" <te******@centr um.sk> wrote in message
news:OO******** ******@tk2msftn gp13.phx.gbl...
I have create Style class instance and set up properties like this:

Style st = new Style();
st.BackColor = Color.Black;
st.BorderColor = Color.White;
st.BorderStyle = BorderStyle.Sol id;
st.BorderWidth = new Unit(1, UnitType.Pixel) ;

string styleStr = string.format(" this.style.cssT ext='{0}', st.ToString());

cell.Attributes .Add("onmouseov er", styleStr);
But st.ToString() seems to always return "" (string.empty). I want to return something like 'background-Color=Black; ... " text.
How the Style() class work and how i can do what i want?

Nov 18 '05 #2
Eliyahu Goldin wrote:
I see you want to apply the style on client side. The easiest way of doing
this is like this:

1. Attach the style "MyStyle" to your page, either in the page header or in
a separate file.
2. cell.Attributes .Add("onmouseov er", "className='MyS tyle'");

Eliyahu

and then change className property on the client side.
"terrorix" <te******@centr um.sk> wrote in message
news:OO******** ******@tk2msftn gp13.phx.gbl...
I have create Style class instance and set up properties like this:

Style st = new Style();
st.BackColor = Color.Black;
st.BorderColor = Color.White;
st.BorderStyle = BorderStyle.Sol id;
st.BorderWidth = new Unit(1, UnitType.Pixel) ;

string styleStr = string.format(" this.style.cssT ext='{0}', st.ToString());

cell.Attributes .Add("onmouseov er", styleStr);
But st.ToString() seems to always return "" (string.empty). I want to

return something like 'background-Color=Black; ... " text.

How the Style() class work and how i can do what i want?

I know i can do this like you wrote. But i creating web custom control. I have properties like:
HotTrack_BackCo lor
HotTrack_Border Color
HotTrack_Border Style
HotTrack_Border Width

and i want to setup these custom properties to control as "this.style.css Text='...'".

Anyway how can i use Style class manually ?
Nov 18 '05 #3
Doesn't look to me like the Style class is good for your task. It is not
intended for this sort of use. Just go through all your style properties and
make a style string out of style attributes like

String.Format(" background-color:{0}", HotTrack_BackCo lor.ToString()) ;

Eliyahu

"terrorix" <te******@centr um.sk> wrote in message
news:u%******** ********@TK2MSF TNGP12.phx.gbl. ..
Eliyahu Goldin wrote:
I see you want to apply the style on client side. The easiest way of doing this is like this:

1. Attach the style "MyStyle" to your page, either in the page header or in a separate file.
2. cell.Attributes .Add("onmouseov er", "className='MyS tyle'");

Eliyahu

and then change className property on the client side.
"terrorix" <te******@centr um.sk> wrote in message
news:OO******** ******@tk2msftn gp13.phx.gbl...
I have create Style class instance and set up properties like this:

Style st = new Style();
st.BackColor = Color.Black;
st.BorderColor = Color.White;
st.BorderStyle = BorderStyle.Sol id;
st.BorderWidth = new Unit(1, UnitType.Pixel) ;

string styleStr = string.format(" this.style.cssT ext='{0}', st.ToString());
cell.Attributes .Add("onmouseov er", styleStr);
But st.ToString() seems to always return "" (string.empty). I want to return something like 'background-Color=Black; ... " text.

How the Style() class work and how i can do what i want?

I know i can do this like you wrote. But i creating web custom control. I

have properties like: HotTrack_BackCo lor
HotTrack_Border Color
HotTrack_Border Style
HotTrack_Border Width

and i want to setup these custom properties to control as "this.style.css Text='...'".
Anyway how can i use Style class manually ?

Nov 18 '05 #4
Eliyahu Goldin wrote:
Doesn't look to me like the Style class is good for your task. It is not
intended for this sort of use. Just go through all your style properties and
make a style string out of style attributes like

String.Format(" background-color:{0}", HotTrack_BackCo lor.ToString()) ;

Eliyahu

I using this technique but i want know if it is another way to the this, more clear.

thanx again.
Nov 18 '05 #5

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

Similar topics

2
1996
by: John | last post by:
The following code works OK in IE 6.0 but does not work in Netscape 7. The image does not shift when one scrolls down but stays stationary in Netscape. Please help Thank you John function moveImage(e){ //shift image according to scroll
7
5176
by: Todd Cary | last post by:
I inherited an application where the Flyout works in Firefox but not in IE. My JavaScript background is sparse, so I am not sure how to approach the problem. Any suggestions are welcomed! The performance can be viewed at http://209.204.172.137/casesearch/php/all.php Here is the base JavaScript:
3
4086
by: David | last post by:
Hi, I have 3 buttons on a asp.net page. They are exactly the same except for the name. Two of the buttons works but the third one does not respond to the clicking. Here is the code: <tr> <td align="right" style="PADDING-LEFT: 10px; PADDING-TOP: 5px"> <INPUT class="tabButton" id="cmdGenSetup" align="left"
1
3846
by: smilecry | last post by:
I am trying to create a tree table (javascript code was adopted from online source) but the rowspan in td tag does not work well when I toggle the rows. Here is the sample code, notice the row "4" should be in the Type 1 section (click on the arrow and expand it, it will display correctly), but when it is collapsed, it is pushed downwards to...
5
1639
by: Ted Ngo | last post by:
protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { txtSource.Focus(); frmMain.Visible = true; divWait.Visible = false; btnsubmit.Visible = true;
14
3469
by: webEater | last post by:
I have a problem, it's not browser specific, and I don't get a solution. I have an (X)HTML document, I show you a part of it: .... <!--<div class="pad">--> <div id="eventImages"><img src="" id="eventImage0" class="eventImage"><img src="" id="eventImage1" class="eventImage"></div>
2
2027
by: gunnuk | last post by:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <title>WELCOME TO HEMA CREATIVE HOUSE</title> <style type="text/css"> <!-- @import...
1
3652
by: sva0008 | last post by:
i have a auto suggest script that does not work in firefox , works great on IE. /******************************************************* AutoSuggest - a javascript automatic text input completion component Copyright (C) 2005 Joe Kepley, The Sling & Rock Design Group, Inc. This library is free software; you can redistribute it and/or...
2
4291
by: bips2008 | last post by:
The code seems to work fine in other browser but in IE it throws this error. This is very urgent for me and any help would be greatly appreciated For your convienence i have posted the code for the file. The portion that is not working is the star rating part <?php session_start(); include_once('includes/host_conf.php');...
0
7911
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7839
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
8200
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. ...
0
8338
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7954
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
8215
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
6610
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...
0
5390
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
3836
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...

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.