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

Disable controls in insert mode when changes a combo

2 Answers 54 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Gerardo
Top achievements
Rank 1
Gerardo asked on 26 May 2010, 10:10 PM

While the grid is insert mode , I need to disable some controls in this mode. I found the code for disabling in edit mode but not in insert mode , can someone help me


protected void DropDownparamType_SelectedIndexChanged(object sender, EventArgs e) { 
            DropDownList DDL = (DropDownList)sender; 
            GridIndexCollection EditItems = RadGrid1.EditIndexes; 
            if (EditItems.Count > 0) { 
                GridDataItem Item = (GridDataItem)RadGrid1.Items[EditItems[0]]; 
                GridEditFormItem ItemEdit = (GridEditFormItem)Item.EditFormItem; 
 
                /*Habilitar el campo de valores aceptados únicamente cuando el tipo de parámetro es LIST*/ 
                if ((object)ItemEdit["acceptedValues"].FindControl("txtacceptedValues") != null) { 
                    TextBox acceptedValues = (TextBox)ItemEdit["paramType"].FindControl("txtacceptedValues"); 
                    if (DDL.SelectedValue == "3") {//Tipo Lista 
                        acceptedValues.Enabled = true
                        acceptedValues.BackColor = System.Drawing.Color.White; 
                    } 
                    else { 
                        acceptedValues.Enabled = false
                        acceptedValues.BackColor = System.Drawing.Color.FromArgb(204, 204, 204);//#CCCCCC 
                    } 
                } 
            } 
 
        } 


Thanks in advance

2 Answers, 1 is accepted

Sort by
0
Accepted
Princy
Top achievements
Rank 2
answered on 27 May 2010, 08:21 AM
Hello Gerardo,

You could use the GetInsertItem method to get the item when grid in insert mode.

CS:
 
 . . .  
    if (RadGrid1.MasterTableView.IsItemInserted)  
    {  
        GridEditFormInsertItem insertItem = (GridEditFormInsertItem)RadGrid1.MasterTableView.GetInsertItem();  
    }  
 . . . 


Regards,
Princy.
0
Gerardo
Top achievements
Rank 1
answered on 27 May 2010, 02:46 PM
That's the answer I needed .
Thanks  a lot .
Tags
Grid
Asked by
Gerardo
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Gerardo
Top achievements
Rank 1
Share this question
or