I need to set the style of RadNumericTextBox and RadMaskedTextBox controls on my form. When I load the page I go through all of the controls and set the styles based on the type of control. This is in my Page_Load method. It works fine for all standard asp.net controls, but I can't get it to do anything to the styles for the Telerik controls. I've tried using the onblur and onfocus events. Then I tried using the ClientEvents-OnBlur and OnFocus (setting "this.className='bla'", for example) but that didn't work either. So then I tried setting the FocusedStyle.BorderWidth and BorderColor, but that had no affect on the controls either. I can step through in debug and see that these properties ARE set, but the controls don't change at all on focus... Here's the code I'm using to do this:
What is the trick with this and why is it SO HARD to get this to work? Seems like an incredibly simple to want to do, but it took me 5 minutes to do it with the asp.net controls and I've spent 2 hours on this with the Telerik controls and still can't get it working... Frustrating.
Any help? Thanks!!
Eddie
foreach (Control ctl in pnlMain.Controls) |
{ |
if(ctl.GetType() == typeof(TextBox)) |
{ |
((WebControl)ctl).Attributes.Add("onfocus", "this.className='textBoxActive'"); |
((WebControl)ctl).Attributes.Add("onblur", "this.className='textBox'"); |
} |
else if(ctl.GetType() == typeof(RadNumericTextBox)) |
{ |
((RadNumericTextBox)ctl).FocusedStyle.BorderWidth = 2; |
((RadNumericTextBox) ctl).FocusedStyle.BorderColor = Color.DarkSlateBlue; |
} |
else if(ctl.GetType() == typeof(RadMaskedTextBox)) |
{ |
((RadMaskedTextBox)ctl).FocusedStyle.BorderWidth = 2; |
((RadMaskedTextBox)ctl).FocusedStyle.BorderColor = Color.DarkSlateBlue; |
} |
} |
What is the trick with this and why is it SO HARD to get this to work? Seems like an incredibly simple to want to do, but it took me 5 minutes to do it with the asp.net controls and I've spent 2 hours on this with the Telerik controls and still can't get it working... Frustrating.
Any help? Thanks!!
Eddie