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

[Solved] Text Box disabled but still Spinner is enabled.

1 Answer 128 Views
NumericTextBox
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Hari
Top achievements
Rank 1
Hari asked on 07 Dec 2011, 03:49 PM

We are using Integer Text box with Spinners, where user can increase or decrease value.

 

Scenario: We are enabling and disabling text box from JavaScript. Text Box is going disabled but Spinners is still active, where user can modify value.


follow the following options tried:
   1. DIV tag enable / disabled all controls (Enable / Disable Text Box but still spinner is enabled)
   2.  Using onFocus called onBlur (Still is not working)

   3. Remove CSS Classs "$('#txt').removeClass('t-widget t-numerictextbox').removeAttr('disabled');" 


refer attached screen shot.

Code:

@(Html.Telerik().IntegerTextBox()

.Name("txt")

.MinValue(1)

.MaxValue(24)

.Value(1)

.InputHtmlAttributes(new { style = " height:23px; line-height:normal; vertical-align:middle; width:40px;" })

.HtmlAttributes(new { style = " width:40px;  " })

)

 

Javascript Code for Enable and Disable Controls:
function SetDisabled(el, val) {
   try {
         el.disabled = val;
   }
  catch (E) { }

 

     if (el.childNodes && el.childNodes.length > 0) {
       for (var x = 0; x < el.childNodes.length; x++) {
          SetDisabled(el.childNodes[x], val);
                 }
             }
        }

Thanks in Advance.

Regards,
HARI

 

1 Answer, 1 is accepted

Sort by
0
Dimo
Telerik team
answered on 07 Dec 2011, 04:15 PM
Hello Hari,

Is there a reason to disable the IntegerTextbox manually with so much code, instead of using the API?

http://demos.telerik.com/aspnet-mvc/numerictextbox/clientsideapi

Regards,
Dimo
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the Telerik Extensions for ASP.MET MVC, subscribe to their blog feed now
Tags
NumericTextBox
Asked by
Hari
Top achievements
Rank 1
Answers by
Dimo
Telerik team
Share this question
or