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

DIsable Foreign Key Dropdown on edit

2 Answers 85 Views
Grid
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Dave Hayward
Top achievements
Rank 1
Dave Hayward asked on 13 Apr 2012, 06:52 PM
I would like to add a foreign key column to my grid and have it function when in insert mode, but not be editable afterwards. I have tried to detect this condition by using the grid's 'OnEdit' event and if the mode is "edit", access the dropdownlist control and call the disable() method.

I'm not even sure if that's the best way to approach this, but that's what I'm trying to do.

Assuming this would be workable, I've tried the following

function TemplatesGridOnEdit(e) {
    var mode = e.mode;
    var form = e.form;
    if (mode == "edit") {
        $(form).find('#SoldToDropList').data('tDropDownList').disable();
    }
}

(I am not using cell edit mode)

Unfortunately this fails with a claim that the control does not have a 'disable' function. So my question is "how can this be made to work"? Is there a better approach?

TIA

2 Answers, 1 is accepted

Sort by
0
Rajesh
Top achievements
Rank 1
answered on 16 Apr 2012, 07:28 AM
try .style("disabled", "disabled")

best way to figure out the right jquery is to evaluate the expression in the debugger Quickwatch window.
0
Atanas Korchev
Telerik team
answered on 16 Apr 2012, 02:29 PM
Hi,

 This is very strange as as the DropDownList has a disable method. Could you please check whether $(form).find('#SoldToDropList') returns the proper DOM element? I suspect that the selector may be wrong.

Regards,
Atanas Korchev
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
Grid
Asked by
Dave Hayward
Top achievements
Rank 1
Answers by
Rajesh
Top achievements
Rank 1
Atanas Korchev
Telerik team
Share this question
or