473,651 Members | 2,630 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Class not working for textbox.

I cannot seem to get the asp:textbox to use classes. Style works fine. I
am trying to set the textbox to act like a label in some instance so it
doesn't have a border, readonly and the background is grey.

I have a class set as:

..table2Label{
border-style:none;
background-color:#F6F6F6;
}

I have a textbox:

<asp:textbox id="applicantID " class="table2la bel"
TextMode="Singl eLine" Columns="32" runat="server" />

This doesn't seem to work.

If I do this:

<asp:textbox id="applicantID " Style=" border-style:none;
background-color:#F6F6F6;" TextMode="Singl eLine" Columns="32" runat="server"
/>

This works perfectly.

Why doesn't the class?

Thanks,

Tom.
Nov 19 '05 #1
8 3470
tshad wrote:
I cannot seem to get the asp:textbox to use classes. Style works
fine. I am trying to set the textbox to act like a label in some
instance so it doesn't have a border, readonly and the background is
grey.

I have a class set as:

.table2Label{
border-style:none;
background-color:#F6F6F6;
}
I have a textbox:
<asp:textbox id="applicantID " class="table2la bel"
TextMode="Singl eLine" Columns="32" runat="server" />

This doesn't seem to work.


Tom,
You are setting the wrong atttribute.
For Web Server controls, use CSSClass property.

--

Thanks,
Carl Prothman
Microsoft ASP.NET MVP
Nov 19 '05 #2
"Carl Prothman [MVP]" <ca****@spamcop .net> wrote in message
news:OD******** ********@TK2MSF TNGP10.phx.gbl. ..
tshad wrote:
I cannot seem to get the asp:textbox to use classes. Style works
fine. I am trying to set the textbox to act like a label in some
instance so it doesn't have a border, readonly and the background is
grey.

I have a class set as:

.table2Label{
border-style:none;
background-color:#F6F6F6;
}
I have a textbox:
<asp:textbox id="applicantID " class="table2la bel"
TextMode="Singl eLine" Columns="32" runat="server" />

This doesn't seem to work.

Tom,
You are setting the wrong atttribute.
For Web Server controls, use CSSClass property.


I did try that also and it still doesn't seem to work - I am using Mozilla.

I also changed the name to .text2label as I misnamed it.

<asp:textbox id="applicantID " CSSClass="textb ox2Label"
TextMode="Singl eLine" Columns="32" runat="server" />

and

..textbox2Label {
border-style:none;
background-color:#F6F6F6;
}

I also tried this at runtime and it doesn't work there either.

Tom.
--

Thanks,
Carl Prothman
Microsoft ASP.NET MVP

Nov 19 '05 #3
There's nothing wrong with what you are doing. you can either use class or
CssClass (class isn't a recognize proprety so it simply gets rendered as-is
as an html attribute). Probably better to use cssClass so you can program
against it easier..but that isn't your issue.

I've experienced extremely finiky behaviour from firefox with respect to
applying styles to textboxes...sim ple things like extra spaces causing
problems...I imagine you are running into the same problem (and I imagine it
isn't with firefox but something we are doing). Simply try rewriting the
style as:
..table2Label{b order-style:none;back ground-color:#F6F6F6;}

and make sure nothing is indented ...

Lemme know.

Karl

--
MY ASP.Net tutorials
http://www.openmymind.net/
"tshad" <ts**********@f tsolutions.com> wrote in message
news:Od******** ********@TK2MSF TNGP15.phx.gbl. ..
"Carl Prothman [MVP]" <ca****@spamcop .net> wrote in message
news:OD******** ********@TK2MSF TNGP10.phx.gbl. ..
tshad wrote:
I cannot seem to get the asp:textbox to use classes. Style works
fine. I am trying to set the textbox to act like a label in some
instance so it doesn't have a border, readonly and the background is
grey.

I have a class set as:

.table2Label{
border-style:none;
background-color:#F6F6F6;
}
I have a textbox:
<asp:textbox id="applicantID " class="table2la bel"
TextMode="Singl eLine" Columns="32" runat="server" />

This doesn't seem to work.

Tom,
You are setting the wrong atttribute.
For Web Server controls, use CSSClass property.


I did try that also and it still doesn't seem to work - I am using

Mozilla.
I also changed the name to .text2label as I misnamed it.

<asp:textbox id="applicantID " CSSClass="textb ox2Label"
TextMode="Singl eLine" Columns="32" runat="server" />

and

.textbox2Label{
border-style:none;
background-color:#F6F6F6;
}

I also tried this at runtime and it doesn't work there either.

Tom.

--

Thanks,
Carl Prothman
Microsoft ASP.NET MVP


Nov 19 '05 #4
"Karl Seguin" <karl REMOVE @ REMOVE openmymind REMOVEMETOO . ANDME net>
wrote in message news:OR******** ********@TK2MSF TNGP11.phx.gbl. ..
There's nothing wrong with what you are doing. you can either use class
or
CssClass (class isn't a recognize proprety so it simply gets rendered
as-is
as an html attribute). Probably better to use cssClass so you can program
against it easier..but that isn't your issue.

I've experienced extremely finiky behaviour from firefox with respect to
applying styles to textboxes...sim ple things like extra spaces causing
problems...I imagine you are running into the same problem (and I imagine
it
isn't with firefox but something we are doing). Simply try rewriting
the
style as:
.table2Label{bo rder-style:none;back ground-color:#F6F6F6;}

and make sure nothing is indented ...
Nope.

I also tried IE and Netscape and they don't work either.

Does this statement look right?

<asp:textbox id="applicantID " Class="textbox2 Label"
TextMode="Singl eLine" Columns="32" runat="server" />

Here is the CSS file from the beginning to just after the text2label class.
*************** *************** *************** **
body {
margin:0;
padding:0;
font-family: Verdana, Arial, Helvetica, sans-serif;
}
th {
background-color:#2FABAD;
color:white;
text-decoration: none;
border-style:none;
font-family: Verdana, Arial, Helvetica, sans-serif;
}
..dataGrid {
background-color:#2FABAD;
color:white;
border-style:none;
font-family: Verdana, Arial, Helvetica, sans-serif;
}

..dataGrid a:visited {color:#FFFFFF; font-weight:bold;
}
..dataGrid a:link {color:#FFFFFF; font-weight:bold;
}
..dataGrid a:active {color:#FFFFFF; font-weight:bold;
}

..table2Label{b order-style:none;back ground-color:#F6F6F6;}

..console{
background-color:#2FABAD;
color:white;
text-decoration: none;
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size:12;
}
*************** *************** *************** **********

Here it is rendered in IE (looks right)

*************** *************** *************** *************** *********
<tr valign="baselin e">
<td width="160" align="right" nowrap class="BodyText ">Applicant
ID:</td>
<td >
<input name="applicant ID" type="text" value="1000" size="32"
readonly="reado nly" id="applicantID " Class="textbox2 Label" />
</td>
</tr>
*************** *************** *************** *************** *************** *

Here it is in Mozilla (also appears correct):
*************** *************** *************** *************** ***************
<tr valign="baselin e">
<td width="160" align="right" nowrap class="BodyText ">Applicant
ID:</td>
<td >
<input name="applicant ID" type="text" value="1000" size="32"
readonly="reado nly" id="applicantID " Class="textbox2 Label" />
</td>
</tr>
*************** *************** *************** *************** *************** *

This is what drives me crazy. I spend hours or days trying to get something
to work that should work. I have spent the whole day on this and can't seem
to get it to work.

I think I am just going to create an identical page and change all the
textboxes to labels as I can't spend too much more time on this.

Thanks,

Tom

Lemme know.

Karl

--
MY ASP.Net tutorials
http://www.openmymind.net/
"tshad" <ts**********@f tsolutions.com> wrote in message
news:Od******** ********@TK2MSF TNGP15.phx.gbl. ..
"Carl Prothman [MVP]" <ca****@spamcop .net> wrote in message
news:OD******** ********@TK2MSF TNGP10.phx.gbl. ..
> tshad wrote:
>> I cannot seem to get the asp:textbox to use classes. Style works
>> fine. I am trying to set the textbox to act like a label in some
>> instance so it doesn't have a border, readonly and the background is
>> grey.
>>
>> I have a class set as:
>>
>> .table2Label{
>> border-style:none;
>> background-color:#F6F6F6;
>> }
>> I have a textbox:
>> <asp:textbox id="applicantID " class="table2la bel"
>> TextMode="Singl eLine" Columns="32" runat="server" />
>>
>> This doesn't seem to work.
>>
>
> Tom,
> You are setting the wrong atttribute.
> For Web Server controls, use CSSClass property.


I did try that also and it still doesn't seem to work - I am using

Mozilla.

I also changed the name to .text2label as I misnamed it.

<asp:textbox id="applicantID " CSSClass="textb ox2Label"
TextMode="Singl eLine" Columns="32" runat="server" />

and

.textbox2Label{
border-style:none;
background-color:#F6F6F6;
}

I also tried this at runtime and it doesn't work there either.

Tom.
>
> --
>
> Thanks,
> Carl Prothman
> Microsoft ASP.NET MVP
>
>



Nov 19 '05 #5
Not sure if this was intentional, but in your code you have;

<asp:textbox id="applicantID " Class="textbox2 Label"
TextMode="Singl eLine" Columns="32" runat="server" />

And in your CSS you have;

..table2Label{b order-style:none;back ground-color:#F6F6F6;}

The class names don't match, if I'm reading in the correct place.

Also double-check to make certain the CSS file is actually referenced in
your page, that would bite you as well.

Do a view-source on the resulting code to see how the textbox is rendering,
to make certain everything matches up as you intended.

All else looks spot-on.

/// M
"tshad" <ts**********@f tsolutions.com> wrote in message
news:#V******** ******@tk2msftn gp13.phx.gbl...
"Karl Seguin" <karl REMOVE @ REMOVE openmymind REMOVEMETOO . ANDME net>
wrote in message news:OR******** ********@TK2MSF TNGP11.phx.gbl. ..
There's nothing wrong with what you are doing. you can either use class
or
CssClass (class isn't a recognize proprety so it simply gets rendered
as-is
as an html attribute). Probably better to use cssClass so you can program against it easier..but that isn't your issue.

I've experienced extremely finiky behaviour from firefox with respect to
applying styles to textboxes...sim ple things like extra spaces causing
problems...I imagine you are running into the same problem (and I imagine it
isn't with firefox but something we are doing). Simply try rewriting
the
style as:
.table2Label{bo rder-style:none;back ground-color:#F6F6F6;}

and make sure nothing is indented ...
Nope.

I also tried IE and Netscape and they don't work either.

Does this statement look right?

<asp:textbox id="applicantID " Class="textbox2 Label"
TextMode="Singl eLine" Columns="32" runat="server" />

Here is the CSS file from the beginning to just after the text2label

class. *************** *************** *************** **
body {
margin:0;
padding:0;
font-family: Verdana, Arial, Helvetica, sans-serif;
}
th {
background-color:#2FABAD;
color:white;
text-decoration: none;
border-style:none;
font-family: Verdana, Arial, Helvetica, sans-serif;
}
.dataGrid {
background-color:#2FABAD;
color:white;
border-style:none;
font-family: Verdana, Arial, Helvetica, sans-serif;
}

.dataGrid a:visited {color:#FFFFFF; font-weight:bold;
}
.dataGrid a:link {color:#FFFFFF; font-weight:bold;
}
.dataGrid a:active {color:#FFFFFF; font-weight:bold;
}

.table2Label{bo rder-style:none;back ground-color:#F6F6F6;}

.console{
background-color:#2FABAD;
color:white;
text-decoration: none;
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size:12;
}
*************** *************** *************** **********

Here it is rendered in IE (looks right)

*************** *************** *************** *************** *********
<tr valign="baselin e">
<td width="160" align="right" nowrap class="BodyText ">Applicant
ID:</td>
<td >
<input name="applicant ID" type="text" value="1000" size="32"
readonly="reado nly" id="applicantID " Class="textbox2 Label" />
</td>
</tr>
*************** *************** *************** *************** *************** *
Here it is in Mozilla (also appears correct):
*************** *************** *************** *************** *************** <tr valign="baselin e">
<td width="160" align="right" nowrap class="BodyText ">Applicant
ID:</td>
<td >
<input name="applicant ID" type="text" value="1000" size="32"
readonly="reado nly" id="applicantID " Class="textbox2 Label" />
</td>
</tr>
*************** *************** *************** *************** *************** *
This is what drives me crazy. I spend hours or days trying to get something to work that should work. I have spent the whole day on this and can't seem to get it to work.

I think I am just going to create an identical page and change all the
textboxes to labels as I can't spend too much more time on this.

Thanks,

Tom

Lemme know.

Karl

--
MY ASP.Net tutorials
http://www.openmymind.net/
"tshad" <ts**********@f tsolutions.com> wrote in message
news:Od******** ********@TK2MSF TNGP15.phx.gbl. ..
"Carl Prothman [MVP]" <ca****@spamcop .net> wrote in message
news:OD******** ********@TK2MSF TNGP10.phx.gbl. ..
> tshad wrote:
>> I cannot seem to get the asp:textbox to use classes. Style works
>> fine. I am trying to set the textbox to act like a label in some
>> instance so it doesn't have a border, readonly and the background is
>> grey.
>>
>> I have a class set as:
>>
>> .table2Label{
>> border-style:none;
>> background-color:#F6F6F6;
>> }
>> I have a textbox:
>> <asp:textbox id="applicantID " class="table2la bel"
>> TextMode="Singl eLine" Columns="32" runat="server" />
>>
>> This doesn't seem to work.
>>
>
> Tom,
> You are setting the wrong atttribute.
> For Web Server controls, use CSSClass property.

I did try that also and it still doesn't seem to work - I am using

Mozilla.

I also changed the name to .text2label as I misnamed it.

<asp:textbox id="applicantID " CSSClass="textb ox2Label"
TextMode="Singl eLine" Columns="32" runat="server" />

and

.textbox2Label{
border-style:none;
background-color:#F6F6F6;
}

I also tried this at runtime and it doesn't work there either.

Tom.
>
> --
>
> Thanks,
> Carl Prothman
> Microsoft ASP.NET MVP
>
>



Nov 19 '05 #6
"MWells" <outbound__at_s ygnal.com> wrote in message
news:%2******** **********@TK2M SFTNGP15.phx.gb l...
Not sure if this was intentional, but in your code you have;

<asp:textbox id="applicantID " Class="textbox2 Label"
TextMode="Singl eLine" Columns="32" runat="server" />

And in your CSS you have;

.table2Label{bo rder-style:none;back ground-color:#F6F6F6;}
You're right. I just changed the names to better match what I was trying to
do and forgot to rename it in the css page. After I did, it didn't help.

The class names don't match, if I'm reading in the correct place.

Also double-check to make certain the CSS file is actually referenced in
your page, that would bite you as well.
I did. If I comment out the line "<link href="staffing. css"
rel="stylesheet " type="text/css">", none of my styles work - so I know it is
being loaded.

Thanks,

Tom
Do a view-source on the resulting code to see how the textbox is
rendering,
to make certain everything matches up as you intended.

All else looks spot-on.

/// M
"tshad" <ts**********@f tsolutions.com> wrote in message
news:#V******** ******@tk2msftn gp13.phx.gbl...
"Karl Seguin" <karl REMOVE @ REMOVE openmymind REMOVEMETOO . ANDME net>
wrote in message news:OR******** ********@TK2MSF TNGP11.phx.gbl. ..
> There's nothing wrong with what you are doing. you can either use
> class
> or
> CssClass (class isn't a recognize proprety so it simply gets rendered
> as-is
> as an html attribute). Probably better to use cssClass so you can program > against it easier..but that isn't your issue.
>
> I've experienced extremely finiky behaviour from firefox with respect
> to
> applying styles to textboxes...sim ple things like extra spaces causing
> problems...I imagine you are running into the same problem (and I imagine > it
> isn't with firefox but something we are doing). Simply try rewriting
> the
> style as:
> .table2Label{bo rder-style:none;back ground-color:#F6F6F6;}
>
> and make sure nothing is indented ...


Nope.

I also tried IE and Netscape and they don't work either.

Does this statement look right?

<asp:textbox id="applicantID " Class="textbox2 Label"
TextMode="Singl eLine" Columns="32" runat="server" />

Here is the CSS file from the beginning to just after the text2label

class.
*************** *************** *************** **
body {
margin:0;
padding:0;
font-family: Verdana, Arial, Helvetica, sans-serif;
}
th {
background-color:#2FABAD;
color:white;
text-decoration: none;
border-style:none;
font-family: Verdana, Arial, Helvetica, sans-serif;
}
.dataGrid {
background-color:#2FABAD;
color:white;
border-style:none;
font-family: Verdana, Arial, Helvetica, sans-serif;
}

.dataGrid a:visited {color:#FFFFFF; font-weight:bold;
}
.dataGrid a:link {color:#FFFFFF; font-weight:bold;
}
.dataGrid a:active {color:#FFFFFF; font-weight:bold;
}

.table2Label{bo rder-style:none;back ground-color:#F6F6F6;}

.console{
background-color:#2FABAD;
color:white;
text-decoration: none;
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size:12;
}
*************** *************** *************** **********

Here it is rendered in IE (looks right)

*************** *************** *************** *************** *********
<tr valign="baselin e">
<td width="160" align="right" nowrap class="BodyText ">Applicant
ID:</td>
<td >
<input name="applicant ID" type="text" value="1000" size="32"
readonly="reado nly" id="applicantID " Class="textbox2 Label" />
</td>
</tr>

*************** *************** *************** *************** *************** *

Here it is in Mozilla (also appears correct):

*************** *************** *************** *************** ***************
<tr valign="baselin e">
<td width="160" align="right" nowrap class="BodyText ">Applicant
ID:</td>
<td >
<input name="applicant ID" type="text" value="1000" size="32"
readonly="reado nly" id="applicantID " Class="textbox2 Label" />
</td>
</tr>

*************** *************** *************** *************** *************** *

This is what drives me crazy. I spend hours or days trying to get

something
to work that should work. I have spent the whole day on this and can't

seem
to get it to work.

I think I am just going to create an identical page and change all the
textboxes to labels as I can't spend too much more time on this.

Thanks,

Tom
>
> Lemme know.
>
> Karl
>
> --
> MY ASP.Net tutorials
> http://www.openmymind.net/
>
>
> "tshad" <ts**********@f tsolutions.com> wrote in message
> news:Od******** ********@TK2MSF TNGP15.phx.gbl. ..
>> "Carl Prothman [MVP]" <ca****@spamcop .net> wrote in message
>> news:OD******** ********@TK2MSF TNGP10.phx.gbl. ..
>> > tshad wrote:
>> >> I cannot seem to get the asp:textbox to use classes. Style works
>> >> fine. I am trying to set the textbox to act like a label in some
>> >> instance so it doesn't have a border, readonly and the background
>> >> is
>> >> grey.
>> >>
>> >> I have a class set as:
>> >>
>> >> .table2Label{
>> >> border-style:none;
>> >> background-color:#F6F6F6;
>> >> }
>> >> I have a textbox:
>> >> <asp:textbox id="applicantID " class="table2la bel"
>> >> TextMode="Singl eLine" Columns="32" runat="server" />
>> >>
>> >> This doesn't seem to work.
>> >>
>> >
>> > Tom,
>> > You are setting the wrong atttribute.
>> > For Web Server controls, use CSSClass property.
>>
>> I did try that also and it still doesn't seem to work - I am using
> Mozilla.
>>
>> I also changed the name to .text2label as I misnamed it.
>>
>> <asp:textbox id="applicantID " CSSClass="textb ox2Label"
>> TextMode="Singl eLine" Columns="32" runat="server" />
>>
>> and
>>
>> .textbox2Label{
>> border-style:none;
>> background-color:#F6F6F6;
>> }
>>
>> I also tried this at runtime and it doesn't work there either.
>>
>> Tom.
>> >
>> > --
>> >
>> > Thanks,
>> > Carl Prothman
>> > Microsoft ASP.NET MVP
>> >
>> >
>>
>>
>
>



Nov 19 '05 #7
OK.

I seem to have found the problem. I was able to see it when I viewed the
source and tried to run it as a straight HTM file.

I had my link to the css file in there twice. This doesn't cause a problem
in the htm file which worked fine with the text2label class.

But for some reason, having the 2 links in the aspx file, caused it a
problem.

The reason it was in there twice, was because I had taken all the headers
and footers and put them in include files so all my pages would be the same.
I inadvertantly put the link in the include file and forgot to delete it
from my page (so they were there twice). This shouldn't have caused a
problem (as they obviously are identical and worked fine that way in the htm
file) - but it did.

The problem is now is what if you use 2 different css files - will that
cause a problem in asp.net.

Tom

"tshad" <ts**********@f tsolutions.com> wrote in message
news:uC******** ********@TK2MSF TNGP12.phx.gbl. ..
"MWells" <outbound__at_s ygnal.com> wrote in message
news:%2******** **********@TK2M SFTNGP15.phx.gb l...
Not sure if this was intentional, but in your code you have;

<asp:textbox id="applicantID " Class="textbox2 Label"
TextMode="Singl eLine" Columns="32" runat="server" />

And in your CSS you have;

.table2Label{bo rder-style:none;back ground-color:#F6F6F6;}


You're right. I just changed the names to better match what I was trying
to do and forgot to rename it in the css page. After I did, it didn't
help.

The class names don't match, if I'm reading in the correct place.

Also double-check to make certain the CSS file is actually referenced in
your page, that would bite you as well.


I did. If I comment out the line "<link href="staffing. css"
rel="stylesheet " type="text/css">", none of my styles work - so I know it
is being loaded.

Thanks,

Tom

Do a view-source on the resulting code to see how the textbox is
rendering,
to make certain everything matches up as you intended.

All else looks spot-on.

/// M
"tshad" <ts**********@f tsolutions.com> wrote in message
news:#V******** ******@tk2msftn gp13.phx.gbl...
"Karl Seguin" <karl REMOVE @ REMOVE openmymind REMOVEMETOO . ANDME net>
wrote in message news:OR******** ********@TK2MSF TNGP11.phx.gbl. ..
> There's nothing wrong with what you are doing. you can either use
> class
> or
> CssClass (class isn't a recognize proprety so it simply gets rendered
> as-is
> as an html attribute). Probably better to use cssClass so you can

program
> against it easier..but that isn't your issue.
>
> I've experienced extremely finiky behaviour from firefox with respect
> to
> applying styles to textboxes...sim ple things like extra spaces causing
> problems...I imagine you are running into the same problem (and I

imagine
> it
> isn't with firefox but something we are doing). Simply try
> rewriting
> the
> style as:
> .table2Label{bo rder-style:none;back ground-color:#F6F6F6;}
>
> and make sure nothing is indented ...

Nope.

I also tried IE and Netscape and they don't work either.

Does this statement look right?

<asp:textbox id="applicantID " Class="textbox2 Label"
TextMode="Singl eLine" Columns="32" runat="server" />

Here is the CSS file from the beginning to just after the text2label

class.
*************** *************** *************** **
body {
margin:0;
padding:0;
font-family: Verdana, Arial, Helvetica, sans-serif;
}
th {
background-color:#2FABAD;
color:white;
text-decoration: none;
border-style:none;
font-family: Verdana, Arial, Helvetica, sans-serif;
}
.dataGrid {
background-color:#2FABAD;
color:white;
border-style:none;
font-family: Verdana, Arial, Helvetica, sans-serif;
}

.dataGrid a:visited {color:#FFFFFF; font-weight:bold;
}
.dataGrid a:link {color:#FFFFFF; font-weight:bold;
}
.dataGrid a:active {color:#FFFFFF; font-weight:bold;
}

.table2Label{bo rder-style:none;back ground-color:#F6F6F6;}

.console{
background-color:#2FABAD;
color:white;
text-decoration: none;
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size:12;
}
*************** *************** *************** **********

Here it is rendered in IE (looks right)

*************** *************** *************** *************** *********
<tr valign="baselin e">
<td width="160" align="right" nowrap class="BodyText ">Applicant
ID:</td>
<td >
<input name="applicant ID" type="text" value="1000" size="32"
readonly="reado nly" id="applicantID " Class="textbox2 Label" />
</td>
</tr>

*************** *************** *************** *************** *************** *

Here it is in Mozilla (also appears correct):

*************** *************** *************** *************** ***************
<tr valign="baselin e">
<td width="160" align="right" nowrap class="BodyText ">Applicant
ID:</td>
<td >
<input name="applicant ID" type="text" value="1000" size="32"
readonly="reado nly" id="applicantID " Class="textbox2 Label" />
</td>
</tr>

*************** *************** *************** *************** *************** *

This is what drives me crazy. I spend hours or days trying to get

something
to work that should work. I have spent the whole day on this and can't

seem
to get it to work.

I think I am just going to create an identical page and change all the
textboxes to labels as I can't spend too much more time on this.

Thanks,

Tom

>
> Lemme know.
>
> Karl
>
> --
> MY ASP.Net tutorials
> http://www.openmymind.net/
>
>
> "tshad" <ts**********@f tsolutions.com> wrote in message
> news:Od******** ********@TK2MSF TNGP15.phx.gbl. ..
>> "Carl Prothman [MVP]" <ca****@spamcop .net> wrote in message
>> news:OD******** ********@TK2MSF TNGP10.phx.gbl. ..
>> > tshad wrote:
>> >> I cannot seem to get the asp:textbox to use classes. Style works
>> >> fine. I am trying to set the textbox to act like a label in some
>> >> instance so it doesn't have a border, readonly and the background
>> >> is
>> >> grey.
>> >>
>> >> I have a class set as:
>> >>
>> >> .table2Label{
>> >> border-style:none;
>> >> background-color:#F6F6F6;
>> >> }
>> >> I have a textbox:
>> >> <asp:textbox id="applicantID " class="table2la bel"
>> >> TextMode="Singl eLine" Columns="32" runat="server" />
>> >>
>> >> This doesn't seem to work.
>> >>
>> >
>> > Tom,
>> > You are setting the wrong atttribute.
>> > For Web Server controls, use CSSClass property.
>>
>> I did try that also and it still doesn't seem to work - I am using
> Mozilla.
>>
>> I also changed the name to .text2label as I misnamed it.
>>
>> <asp:textbox id="applicantID " CSSClass="textb ox2Label"
>> TextMode="Singl eLine" Columns="32" runat="server" />
>>
>> and
>>
>> .textbox2Label{
>> border-style:none;
>> background-color:#F6F6F6;
>> }
>>
>> I also tried this at runtime and it doesn't work there either.
>>
>> Tom.
>> >
>> > --
>> >
>> > Thanks,
>> > Carl Prothman
>> > Microsoft ASP.NET MVP
>> >
>> >
>>
>>
>
>



Nov 19 '05 #8
That's an interesting scenario; but the behavior shouldn't be any different
under .NET.

Remember that ASP.NET's primary function is to render HTML from nice, neat,
manageable components. At the end of the day, it's all about the HTML that
arrives at the browser.

ASP.NET really knows nothing about CSS files; it's just a <LINK> tag in your
header. Only things with a runat=server attribute are important to ASP.NET,
so all of the pure HTML parts of your page (including your <LINK> tags)
should pass through ASP.NET unscathed.

It sounds like your problem is solved, but if you're pursuing this
academically, here's an interesting test;

Take your ASP.NET page, execute it, view the source and save it as
TEST1.HTM. Then duplicate that HTM file and rename it TEST1.ASPX. Since
it's already rendered, there's no code to execute, and nothing for ASP.NET
to do... but the request will still pass through the .NET infrastructure.

Afaik, accessing both TEST1 files from your browser should give identical
results.
"tshad" <ts**********@f tsolutions.com> wrote in message
news:eR******** ******@TK2MSFTN GP10.phx.gbl...
OK.

I seem to have found the problem. I was able to see it when I viewed the
source and tried to run it as a straight HTM file.

I had my link to the css file in there twice. This doesn't cause a problem in the htm file which worked fine with the text2label class.

But for some reason, having the 2 links in the aspx file, caused it a
problem.

The reason it was in there twice, was because I had taken all the headers
and footers and put them in include files so all my pages would be the same. I inadvertantly put the link in the include file and forgot to delete it
from my page (so they were there twice). This shouldn't have caused a
problem (as they obviously are identical and worked fine that way in the htm file) - but it did.

The problem is now is what if you use 2 different css files - will that
cause a problem in asp.net.

Tom

"tshad" <ts**********@f tsolutions.com> wrote in message
news:uC******** ********@TK2MSF TNGP12.phx.gbl. ..
"MWells" <outbound__at_s ygnal.com> wrote in message
news:%2******** **********@TK2M SFTNGP15.phx.gb l...
Not sure if this was intentional, but in your code you have;

<asp:textbox id="applicantID " Class="textbox2 Label"
TextMode="Singl eLine" Columns="32" runat="server" />

And in your CSS you have;

.table2Label{bo rder-style:none;back ground-color:#F6F6F6;}


You're right. I just changed the names to better match what I was trying to do and forgot to rename it in the css page. After I did, it didn't
help.

The class names don't match, if I'm reading in the correct place.

Also double-check to make certain the CSS file is actually referenced in your page, that would bite you as well.


I did. If I comment out the line "<link href="staffing. css"
rel="stylesheet " type="text/css">", none of my styles work - so I know it is being loaded.

Thanks,

Tom

Do a view-source on the resulting code to see how the textbox is
rendering,
to make certain everything matches up as you intended.

All else looks spot-on.

/// M
"tshad" <ts**********@f tsolutions.com> wrote in message
news:#V******** ******@tk2msftn gp13.phx.gbl...
"Karl Seguin" <karl REMOVE @ REMOVE openmymind REMOVEMETOO . ANDME net> wrote in message news:OR******** ********@TK2MSF TNGP11.phx.gbl. ..
> There's nothing wrong with what you are doing. you can either use
> class
> or
> CssClass (class isn't a recognize proprety so it simply gets rendered > as-is
> as an html attribute). Probably better to use cssClass so you can
program
> against it easier..but that isn't your issue.
>
> I've experienced extremely finiky behaviour from firefox with respect > to
> applying styles to textboxes...sim ple things like extra spaces causing > problems...I imagine you are running into the same problem (and I
imagine
> it
> isn't with firefox but something we are doing). Simply try
> rewriting
> the
> style as:
> .table2Label{bo rder-style:none;back ground-color:#F6F6F6;}
>
> and make sure nothing is indented ...

Nope.

I also tried IE and Netscape and they don't work either.

Does this statement look right?

<asp:textbox id="applicantID " Class="textbox2 Label"
TextMode="Singl eLine" Columns="32" runat="server" />

Here is the CSS file from the beginning to just after the text2label
class.
*************** *************** *************** **
body {
margin:0;
padding:0;
font-family: Verdana, Arial, Helvetica, sans-serif;
}
th {
background-color:#2FABAD;
color:white;
text-decoration: none;
border-style:none;
font-family: Verdana, Arial, Helvetica, sans-serif;
}
.dataGrid {
background-color:#2FABAD;
color:white;
border-style:none;
font-family: Verdana, Arial, Helvetica, sans-serif;
}

.dataGrid a:visited {color:#FFFFFF; font-weight:bold;
}
.dataGrid a:link {color:#FFFFFF; font-weight:bold;
}
.dataGrid a:active {color:#FFFFFF; font-weight:bold;
}

.table2Label{bo rder-style:none;back ground-color:#F6F6F6;}

.console{
background-color:#2FABAD;
color:white;
text-decoration: none;
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size:12;
}
*************** *************** *************** **********

Here it is rendered in IE (looks right)

*************** *************** *************** *************** *********
<tr valign="baselin e">
<td width="160" align="right" nowrap class="BodyText ">Applicant
ID:</td>
<td >
<input name="applicant ID" type="text" value="1000" size="32"
readonly="reado nly" id="applicantID " Class="textbox2 Label" />
</td>
</tr>

*************** *************** *************** *************** *************** *
Here it is in Mozilla (also appears correct):

*************** *************** *************** *************** *************** <tr valign="baselin e">
<td width="160" align="right" nowrap class="BodyText ">Applicant
ID:</td>
<td >
<input name="applicant ID" type="text" value="1000" size="32"
readonly="reado nly" id="applicantID " Class="textbox2 Label" />
</td>
</tr>

*************** *************** *************** *************** *************** *
This is what drives me crazy. I spend hours or days trying to get
something
to work that should work. I have spent the whole day on this and can't seem
to get it to work.

I think I am just going to create an identical page and change all the
textboxes to labels as I can't spend too much more time on this.

Thanks,

Tom

>
> Lemme know.
>
> Karl
>
> --
> MY ASP.Net tutorials
> http://www.openmymind.net/
>
>
> "tshad" <ts**********@f tsolutions.com> wrote in message
> news:Od******** ********@TK2MSF TNGP15.phx.gbl. ..
>> "Carl Prothman [MVP]" <ca****@spamcop .net> wrote in message
>> news:OD******** ********@TK2MSF TNGP10.phx.gbl. ..
>> > tshad wrote:
>> >> I cannot seem to get the asp:textbox to use classes. Style works >> >> fine. I am trying to set the textbox to act like a label in some >> >> instance so it doesn't have a border, readonly and the background >> >> is
>> >> grey.
>> >>
>> >> I have a class set as:
>> >>
>> >> .table2Label{
>> >> border-style:none;
>> >> background-color:#F6F6F6;
>> >> }
>> >> I have a textbox:
>> >> <asp:textbox id="applicantID " class="table2la bel"
>> >> TextMode="Singl eLine" Columns="32" runat="server" />
>> >>
>> >> This doesn't seem to work.
>> >>
>> >
>> > Tom,
>> > You are setting the wrong atttribute.
>> > For Web Server controls, use CSSClass property.
>>
>> I did try that also and it still doesn't seem to work - I am using
> Mozilla.
>>
>> I also changed the name to .text2label as I misnamed it.
>>
>> <asp:textbox id="applicantID " CSSClass="textb ox2Label"
>> TextMode="Singl eLine" Columns="32" runat="server" />
>>
>> and
>>
>> .textbox2Label{
>> border-style:none;
>> background-color:#F6F6F6;
>> }
>>
>> I also tried this at runtime and it doesn't work there either.
>>
>> Tom.
>> >
>> > --
>> >
>> > Thanks,
>> > Carl Prothman
>> > Microsoft ASP.NET MVP
>> >
>> >
>>
>>
>
>



Nov 19 '05 #9

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

Similar topics

9
1501
by: MGRIDEOUT | last post by:
Hello, I have a class called clsPerson. A property of this class is Date_Of_Birth (DOB). In my Access Database the field is date/Time data Type. I am trying to set the class property DOB to the contents of a textbox (txtDOB.text) that the user entered. so I have my:
28
4313
by: kfrost | last post by:
I know this is probably simple but I have a C# form and the class for the form is called sbaSynch. I have a textbox name txtServerName. I'm creating a class to manipulate XML functions so I added a class to project and it's named XmlApi(). In the XmlAPI() class I have simple code as following XmlAPI() { string str = "Some Text";
19
1960
by: hamil | last post by:
I have a form with one button, Button1, and a Textbox, Textbox1 I have a class, class1 as follows. Public Class Class1 Public DeForm As Object Sub doit() DeForm.Textbox1.text = "It works" End Sub End Class
1
1635
by: Anthony Nystrom | last post by:
I am trying to pass a text stream from streamwriter class to a richtextbox, or textbox doesn't matter which one. I have the file write version working fine such as: x.streamwriter = System.IO.File.CreateText("C:\text.txt") Anyway to write to a textbox or rtf rather than file... ? Thanks in advance...
6
6721
by: Lore Leunoeg | last post by:
Hello I derived a class MyControl from the Control class. Public Class MyControl Inherits Control Sub New() MyBase.New() End Sub End Class
16
13335
by: Joel Byrd | last post by:
I am having this ridiculous problem of trying to set the innerHTML of a div node. It works in all other browsers, but internet explorer is giving me an "Unknown runtime error". This is actually in the context of developing an auto-suggest (basically reverse-engineering Google Suggest), but I don't see how any of the other code has anything to do with it. I *pretty sure* that I've narrowed it down to 1 line (the line on which the...
16
4155
by: Mike | last post by:
Hi, I have a form with some controls, and a different class that needs to modify some control properties at run time. Hoy can I reference the from so I have access to its controls and therefore being able to modify its properties?
20
4029
by: tshad | last post by:
Using VS 2003, I am trying to take a class that I created to create new variable types to handle nulls and track changes to standard variable types. This is for use with database variables. This tells me if a variable has changed, give me the original and current value, and whether the current value and original value is/was null or not. This one works fine but is recreating the same methods over and over for each variable type. ...
2
1294
Hutt
by: Hutt | last post by:
Hello, I'm fairly new to vb.net and have a question I can't find an answer to. The site I'm working on is complex, but to keep things simple here's the basic problem. I have a site designed with a textbox on the default.aspx page, and I have a class in the App_Code folder (class1.vb). When the class1.vb code runs I need it to read the text from the textbox (i.e. theText = TextBox1.Text), but Visual Studio underlines TextBox1 in blue saying...
0
8275
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 synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8795
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. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8576
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 choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7296
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 launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5609
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 into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4143
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 the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
2696
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1906
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1585
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 effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.