This is a migrated thread and some comments may be shown as answers.

RadNumbericTextBox loses class on mouseover

1 Answer 40 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Nik
Top achievements
Rank 1
Nik asked on 07 Mar 2011, 09:45 PM
I have a textbox within a repeater...
<rad:RadNumericTextBox ID="radNumQty" runat="server" CssClass="txtbox" Width="40px" IncrementSettings-Step="1" MinValue="1" MaxValue="9999999" MaxLength="7" NumberFormat-DecimalDigits="0" ClientEvents-OnValueChanging="clientUpsellChanges">
</rad:RadNumericTextBox>

In my clientUpsellChanges function, I change its' class if there is an error.
if (intQtyError != 0) {
// Toggle css on field with error
var radQtyBox = $find(arrExtraItemFields[0]);
radQtyBox.TextBoxElement.className = "txtboxerror";
}

This all works fine, but I'm finding that the error class gets removed as soon as you mouseover the box. Why is this? How do I prevent it?

1 Answer, 1 is accepted

Sort by
0
Tsvetina
Telerik team
answered on 10 Mar 2011, 03:08 PM
Hello Nik,

In order to change the style of RadNumericTextBox and preserve it on focus, mouseover, etc. you should change the respective InputStyles of the control, e.g.:
function changeStyle(sender, eventArgs) { 
    var textbox = $find("<%=RadNumericTextBox1.ClientID %>"); 
    textbox.get_styles().EnabledStyle[1] += " riRed"
    textbox.get_styles().FocusedStyle[1] += " riRed"
    textbox.get_styles().HoveredStyle[1] += " riRed"
    textbox.updateCssClass(); 
}


Kind regards,
Tsvetina
the Telerik team
Registration for Q1 2011 What’s New Webinar Week is now open. Mark your calendar for the week starting March 21st and book your seat for a walk through all the exciting stuff we ship with the new release!
Tags
General Discussions
Asked by
Nik
Top achievements
Rank 1
Answers by
Tsvetina
Telerik team
Share this question
or