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

3 posts, 1 answers
  1. Boris
    Boris avatar
    276 posts
    Member since:
    Oct 2012

    Posted 05 Nov 2012 Link to this post

    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. Answer
    Eyup
    Admin
    Eyup avatar
    3015 posts

    Posted 08 Nov 2012 Link to this post

    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.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Boris
    Boris avatar
    276 posts
    Member since:
    Oct 2012

    Posted 08 Nov 2012 Link to this post

    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.)
Back to Top