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

EditForm inside RadGrid

1 Answer 81 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
archimede
Top achievements
Rank 1
archimede asked on 08 Jul 2010, 09:39 AM

I want to hide/show by code some controls inside a radgrid's editform.

I have a radgrid. The user clicks on a row and the custom editform is showed because we are in edit mode. Inside this form I have some controls bounded with datasource data. How can I hide some controls by code?

I tried the ItemCommand event but it seems I cannot access the controls in edit :(

protected void RadGridParametriConfigurazione_ItemCommand(object source, GridCommandEventArgs e)
    {
        switch (e.CommandName)
        {
            case "Edit":
                GridEditableItem editedItem = (GridEditableItem)(e.Item);
                GridEditManager editMan = editedItem.EditManager;
                GridTemplateColumnEditor templateColumnValoreEditor = (GridTemplateColumnEditor)(editMan.GetColumnEditor("TemplateColumnValore"));
                GridTemplateColumnEditor templateColumnDescrizioneEditor = (GridTemplateColumnEditor)(editMan.GetColumnEditor("TemplateColumnDescrizione"));
                GridCheckBoxColumnEditor checkBoxColumnEditor = (GridCheckBoxColumnEditor)(editMan.GetColumnEditor("Abilitato"));
  
                checkBoxColumnEditor.ContainerControl.Controls[0].Visible = false  
                break;
        }
    }
}

How can I do this?

1 Answer, 1 is accepted

Sort by
0
Accepted
Shinu
Top achievements
Rank 2
answered on 08 Jul 2010, 10:43 AM
Hello,


You can access the control in ItemCreated/ItemDataBound event of RadGrid and set the Visible property to "False" in order to hide it. Get reference to GridEditFormItem and use the FindControl method to access the control. Referring the following documentation will be helpful which describes a similar approach.
Referencing controls in grid row/edit form


-Shinu.
Tags
General Discussions
Asked by
archimede
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Share this question
or