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

Unable to find a usable method for enabling/disabling a textbox in a FormTemplate

2 Answers 83 Views
Input
This is a migrated thread and some comments may be shown as answers.
Boris
Top achievements
Rank 1
Boris asked on 05 Nov 2012, 03:05 PM
I've got textboxes within a RadGrid FormTemplate.  I am getting the handles for the textboxes with the methods illustrated here: http://www.telerik.com/community/code-library/aspnet-ajax/grid/accessing-server-controls-in-a-grid-template-on-the-client.aspx

I have the handles to the textboxs.  That is not in doubt.

The problem is, I cannot find any usable way to enable or disable them through Javascript.

Either nothing happens or the page crashes.

(And there seem to be a dozen different methods out there.  enable()/disable().  attr/removeattr, disabled =true/false,  etc.)

2 Answers, 1 is accepted

Sort by
0
Accepted
Eyup
Telerik team
answered on 08 Nov 2012, 01:37 PM
Hello Boris,

Please try the following approach:
function buttonClicked() {
    var editForm = $find("<%=RadGrid1.ClientID%>").get_masterTableView().get_editItems()[0].get_editFormItem();
    var textBox = $telerik.findElement(editForm, "TextBox1");
    if (textBox) {
        textBox.disabled = true;
    }
}

I hope this will prove helpful. Please give it a try and let me know about the result.

Regards,
Eyup
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 RadControls for ASP.NET AJAX, subscribe to their blog feed now.
0
Boris
Top achievements
Rank 1
answered on 08 Nov 2012, 02:01 PM
Thanks for your response.  It worked. 

(Although I'm still a bit confused as to why I couldn't use the handles I got back from GetGridServerElement in the same manner.)
Tags
Input
Asked by
Boris
Top achievements
Rank 1
Answers by
Eyup
Telerik team
Boris
Top achievements
Rank 1
Share this question
or