I have a RadSpinEditor with the following ValueChanging event handler:
Basically if the user has other requirements that depend on the value in the spin editor I don't want them to be allowed to change the spinner. That seems to work fine, but the buttons on the spinner get stuck once the operation has been Cancelled, and the next time that button is pressed it behaves as though it was in it's old state. For example (assuming the spinner has an integer value), I increment the spinner to 3 (#1 from screen shot). Let's say the user has a requirement that prevents them from lowering the spinner value below 2. Now I decrement the spinner twice (#2 from screen shot). The first one works, lowering the value to 2. The second click causes the operation to be canceled. Now say I increment the value to 5 (#3 from screen shot, note 'depressed' spinner button'). The NEXT time I try to decrement (just once), the value returns to 2 (#4 from screen shot), the last value that caused the operation to be cancelled. I would expect it to return to 4, 3, then 2. You can see that the down button on the spinner stays highlighted after the operation is cancelled. I know this probably sounds confusing. Please try to follow the screen shot provided, and let me know if you need more detail.
private
void
CrewQtyText_ValueChanging(
object
sender, Telerik.WinControls.UI.ValueChangingEventArgs e)
{
foreach
(Telerik.WinControls.UI.GridViewRowInfo row
in
RequiredRolesGrid.Rows)
{
if
(Convert.ToInt16(row.Cells[
"Workgroup"
].Value) > Convert.ToInt16(e.NewValue))
{
e.Cancel =
true
;
break
;
}
}
if
(!e.Cancel)
foreach
(Telerik.WinControls.UI.GridViewRowInfo row
in
RequiredEquipGrid.Rows)
{
if
(Convert.ToInt16(row.Cells[
"Workgroup"
].Value) > Convert.ToInt16(e.NewValue))
{
e.Cancel =
true
;
break
;
}
}
if
(e.Cancel)
MessageBox.Show(
"Requirements already exist for workgroup "
+ e.OldValue);
}
Basically if the user has other requirements that depend on the value in the spin editor I don't want them to be allowed to change the spinner. That seems to work fine, but the buttons on the spinner get stuck once the operation has been Cancelled, and the next time that button is pressed it behaves as though it was in it's old state. For example (assuming the spinner has an integer value), I increment the spinner to 3 (#1 from screen shot). Let's say the user has a requirement that prevents them from lowering the spinner value below 2. Now I decrement the spinner twice (#2 from screen shot). The first one works, lowering the value to 2. The second click causes the operation to be canceled. Now say I increment the value to 5 (#3 from screen shot, note 'depressed' spinner button'). The NEXT time I try to decrement (just once), the value returns to 2 (#4 from screen shot), the last value that caused the operation to be cancelled. I would expect it to return to 4, 3, then 2. You can see that the down button on the spinner stays highlighted after the operation is cancelled. I know this probably sounds confusing. Please try to follow the screen shot provided, and let me know if you need more detail.