473,385 Members | 1,752 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,385 software developers and data experts.

TextBox.Style.Add

The following works great....
TextBox10.Style.Add(HtmlTextWriterStyle.TextAlign, "center");

Now I know that HtmlTextWriterStyle is an enumerations and that TextAlign is
int 36.

I am in a situation where I am getting passed the values of the enumeration
but if I say TextBox10.Style.Add(String1, String2) and String1 Contains 36
or "HtmlTextWriterStyle.36" or "TextAlign" the proper html does not get
rendered. The rendered html has exactly what string1 has.

What has to be in the value of string1 to get the html rendered correctly?

Thanks,

T
Aug 20 '06 #1
2 6703
Hi Tina,

Why not pass around the HtmlTextWriterStyle value instead of a string representation?

If you don't have any choice in the matter, the following code should work as long as String1 is "TextAlign" or "36", but not
"HtmlTextWriterStyle.36":

// Parse String1 into an HtmlTextWriterStyle enum value using the Enum.Parse method and cast the result
HtmlTextWriterStyle parsedStyle = (HtmlTextWriterStyle) Enum.Parse(typeof(HtmlTextWriterStyle), String1);

textBox10.Style.Add(parsedStyle, String2);

--
Dave Sexton

"Tina" <Ti**********@nospamexcite.comwrote in message news:%2****************@TK2MSFTNGP02.phx.gbl...
The following works great....
TextBox10.Style.Add(HtmlTextWriterStyle.TextAlign, "center");

Now I know that HtmlTextWriterStyle is an enumerations and that TextAlign is int 36.

I am in a situation where I am getting passed the values of the enumeration but if I say TextBox10.Style.Add(String1, String2) and
String1 Contains 36 or "HtmlTextWriterStyle.36" or "TextAlign" the proper html does not get rendered. The rendered html has
exactly what string1 has.

What has to be in the value of string1 to get the html rendered correctly?

Thanks,

T


Aug 20 '06 #2
Dave,
Thank you so much. That worked just fine.
T
"Dave Sexton" <dave@jwa[remove.this]online.comwrote in message
news:eb**************@TK2MSFTNGP02.phx.gbl...
Hi Tina,

Why not pass around the HtmlTextWriterStyle value instead of a string
representation?

If you don't have any choice in the matter, the following code should work
as long as String1 is "TextAlign" or "36", but not
"HtmlTextWriterStyle.36":

// Parse String1 into an HtmlTextWriterStyle enum value using the
Enum.Parse method and cast the result
HtmlTextWriterStyle parsedStyle = (HtmlTextWriterStyle)
Enum.Parse(typeof(HtmlTextWriterStyle), String1);

textBox10.Style.Add(parsedStyle, String2);

--
Dave Sexton

"Tina" <Ti**********@nospamexcite.comwrote in message
news:%2****************@TK2MSFTNGP02.phx.gbl...
>The following works great....
TextBox10.Style.Add(HtmlTextWriterStyle.TextAlign , "center");

Now I know that HtmlTextWriterStyle is an enumerations and that TextAlign
is int 36.

I am in a situation where I am getting passed the values of the
enumeration but if I say TextBox10.Style.Add(String1, String2) and
String1 Contains 36 or "HtmlTextWriterStyle.36" or "TextAlign" the proper
html does not get rendered. The rendered html has exactly what string1
has.

What has to be in the value of string1 to get the html rendered
correctly?

Thanks,

T



Aug 20 '06 #3

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

Similar topics

2
by: Mike | last post by:
Hello all, I have a form with a checkbox labeled other. I want to make it so if the user clicks "other" a textbox appears right next to it allowing them to fill in their value. If the other...
7
by: Alex | last post by:
<html> <body> <form> <input type="textbox" id="myTxt" value="what's my width?" onClick="alert(this.width)"> </form> </body> </html> how can I get a handle on the width of that textbox? Or...
6
by: Leonard | last post by:
How do I right justify input data in a textbox? I have some textboxes that are used to input numbers, and I would like to right justify them.
6
by: tfs | last post by:
I am trying to display some data that is about 200 characters long and I was trying to display it on the screen in a textbox <asp:textbox /> But I don't want any borders. How would I...
3
by: Henry | last post by:
Hi. I've also posted this at another discussion board and here is the original question. ------------------------- "I have this problem and I don't know what I can do. First of all, I have a...
2
by: localhost | last post by:
How can I style a TextBox so it appears like a label when rendered? Thanks.
0
by: Q. John Chen | last post by:
I created a simple WebForm. Grid Layout. I put textBoxs on it. In IE, some show flat style but some show regular required field with yellow background. What I did was copy past and I can't...
6
by: Chrysan | last post by:
I have few textboxes in a page(.aspx), and some of the textboxes with white color BackColor, blue color Border Line (like xp-style control), but some of the textboxes with yellow color BackColor,...
9
by: ujjc001 | last post by:
hello, I am in asp.net and have a form with an asp textbox. I specify a cssclass for the text box having the following: ..Textbox { font-size: 8pt; list-style-type: none; background-color:...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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
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,...
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
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,...

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.