Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 Development Tools
 ASP.NET
 High light the Number in Color

Author  Topic 

saidev
Posting Yak Master

101 Posts

Posted - 2006-09-13 : 00:37:26
Hi Guys,

I am displaying one of the ID number in the Text box. I want that Number to be in Red Color, not the Text box just the number. can you guys help me what are the properties i need to set in order to display the number in Red Color. I am using ASP.NET/VB.NET
appreciate your help
Thanks,

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2006-09-13 : 00:43:53
Text1.TextColor = vbRed


Peter Larsson
Helsingborg, Sweden
Go to Top of Page

timmy
Master Smack Fu Yak Hacker

1242 Posts

Posted - 2006-09-13 : 01:11:31
quote:
Originally posted by Peso

Text1.TextColor = vbRed


Peter Larsson
Helsingborg, Sweden



That's VB6 unless I'm very much mistaken.....

saidev:
You should really RTFM before posting these sorts of questions....
Go to Top of Page

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2006-09-13 : 01:24:04
I think this is true even in VB.Net and ASP.Net


Peter Larsson
Helsingborg, Sweden
Go to Top of Page

timmy
Master Smack Fu Yak Hacker

1242 Posts

Posted - 2006-09-13 : 01:27:43
I think the enums are named differently, that's all.
Go to Top of Page

dfiala
Posting Yak Master

116 Posts

Posted - 2006-09-13 : 01:35:32
TextBox.ForeColor = Color.Red

or
SelectName.ForeColor = System.Drawing.Color.Red

if you haven't Imported System.Drawing

Of course, using a CssClass will make your life easier in the long run.

Dean Fiala
Very Practical Software, Inc
Now with Blogging...
http://www.vpsw.com/blogbaby
Microsoft MVP
Go to Top of Page

saidev
Posting Yak Master

101 Posts

Posted - 2006-09-13 : 15:05:59
Hi guys,

when i uses this property it doesn't work for me. can you guys tell me why..?
Thanks,

Me.txtContractNo.ForeColor() = Color.Red
or
Me.txtContractNo.ForeColor = Color.Red
i tried both of them but didn't work

Go to Top of Page

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2006-09-13 : 15:09:47
Where did you put the code to color the text red?
Why are you using ForeColor? Try TextColor.


Peter Larsson
Helsingborg, Sweden
Go to Top of Page

saidev
Posting Yak Master

101 Posts

Posted - 2006-09-13 : 16:21:32
Hi,

TextColor was not in VB.NET. I put this code in page_load also i tried in where i populate the Data. Still it doesn't work
Thanks
Go to Top of Page

dfiala
Posting Yak Master

116 Posts

Posted - 2006-09-13 : 16:28:51
This works perfectly fine...

Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
TextBox1.ForeColor = Color.Red
End Sub

What does your rendered html look like for the text box? Check the View Source on the browser. It should look something like this...

<input name="TextBox1" type="text" id="TextBox1" style="color:Red;" />

Dean Fiala
Very Practical Software, Inc
Now with Blogging...
http://www.vpsw.com/blogbaby
Microsoft MVP
Go to Top of Page

saidev
Posting Yak Master

101 Posts

Posted - 2006-09-14 : 13:32:16
Hi,
I tried this but still doesnot work. i have code in HTML like this
THanks

<asp:textbox id="txtContractNo" style="Z-INDEX: 115; LEFT: 152px; POSITION: absolute; TOP: 160px"
tabIndex="2" runat="server" Width="160px" CssClass="txtContractNo" ForeColor="Red"></asp:textbox>
Go to Top of Page

jsmith8858
Dr. Cross Join

7423 Posts

Posted - 2006-09-14 : 13:40:40
quote:
Originally posted by saidev

Hi,
I tried this but still doesnot work. i have code in HTML like this
THanks

<asp:textbox id="txtContractNo" style="Z-INDEX: 115; LEFT: 152px; POSITION: absolute; TOP: 160px"
tabIndex="2" runat="server" Width="160px" CssClass="txtContractNo" ForeColor="Red"></asp:textbox>



What is the CSS definition for txtContracNo ? That is a horrible way to use CSS, by the way -- of you want an individual style for an individual element, you should use #ID syntax on your style sheet.

- Jeff
Go to Top of Page
   

- Advertisement -