views:

226

answers:

4

I am using the following CSS class to hide a textbox in an asp:UpdatePanel to accept input from a USB card reader.

<style type="text/css">
    .USBBox
    {
        position: absolute;
        left: -999em;
    }
</style>

When I click an asp:LinkButton control that is configured to be an asp:AsyncPostBackTrigger for the update panel the control appears on the page and the CSS class is not applied to the asp:TextBox control.

This behavior is displayed in IE7. It works as expected in FireFox 3.5.7

What would cause this behavior and how do I resolve it

A: 

There my be a specificity issue. Try

input.USBBox{ position:absolute!important; left:-999px!important; }

And if it works, back out of the !important tags to see what actually caused the issue.

Also declare display:block; just in case.

Christopher Altman
@Christopher - No dice. Neither suggestion did not solve the issue.
Michael Kniskern
A: 

I think you should use:

.USBBox
{
    display: none;
}

or maybe use a asp:HiddenField instead of a textbox.

kaba
@Kaba - I tried using the `display: none` solution and it does not work because the card reader output the track data into an input control will focus set on it. The only way I could get it to work was with the current CSS class
Michael Kniskern
A: 

try

.USBBox
{
    display: block;
    width: 100px; /* or however wide you want it */
    position: absolute;
    left: -999em;
    background: #ff0000; /* visually ensure the class style is being applied, remove it later */
}

position should only work on items that are displayed as a block. form items by default are displayed inline.

also just for giggles set the background color just to make sure the input box is taking class.

michael herndon
@Michael - This did not work either. It will only read and parse the track data when the display attribute is not explicitly set.
Michael Kniskern
Is this javascript doing the data tracking or serverside?. do you have an online demo of this?Is IE in quirks mode or standards mode?
michael herndon
@Michael - I currently do not have a place to live test it.
Michael Kniskern
A: 

Could it be that the new control comes with multiple classes ?

Because IE is having issues when combining classes on a single element..

Gaby
@Not sure, the only class being applied (that I know of) that is being applied to the `asp:Textbox` is the USBBox.
Michael Kniskern
i do not suppose you have this somewhere live so we can live-test it ?
Gaby
@Gaby - I currently do not have a place to live test it.
Michael Kniskern