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

editselectedcommandname: Disable dropdowncolumn control

3 Answers 82 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Brindavan
Top achievements
Rank 1
Brindavan asked on 18 Mar 2009, 09:38 AM
Hi,

When I select a grid row and click on edit, the 'editselectedcommandname' command gets fired.
I have to perform some operations in ItemCommand method of grid based on this commandName.

When user clicks on edit, the row is opened in edit mode. One of this edit item is a dropdown.
i have to disable the dropdown.

Any pointers in this regard will help.


Brindavan

3 Answers, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 18 Mar 2009, 10:49 AM
Hello Brindavan,

You can check if the row is in editmode in the ItemDataBound event and then access and disable the dropdowncontrol:
cs:
 protected void RadGrid1_ItemDataBound(object sender, GridItemEventArgs e) 
    { 
        if (e.Item is GridEditableItem && e.Item.IsInEditMode) 
        { 
            GridEditableItem editItem = (GridEditableItem)e.Item; 
            ((DropDownList)editItem.FindControl("DropDownListID")).Enabled = false
        } 
    } 

Thanks
Princy.
0
Brindavan
Top achievements
Rank 1
answered on 18 Mar 2009, 11:50 AM
Hi Princy,

Thanks for the reply.
I am looking to do this in ItemCommand event when command name is Radgrid.editselectedcommandname
I tried the above method but since the source is the command button, I am not able to caste it as GridEditableItem

Brindavan
0
Brindavan
Top achievements
Rank 1
answered on 18 Mar 2009, 02:34 PM
Thanks Princy.
I got the implementation with slight change in the code that you mentioned.

I used ((DropDownList)editItem["ColumnName"].Controls[0]).Enabled = false;

Thanks again!
Tags
Grid
Asked by
Brindavan
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Brindavan
Top achievements
Rank 1
Share this question
or