EditForm inside RadGrid

2 posts, 1 answers
  1. archimede
    archimede avatar
    103 posts
    Member since:
    Jul 2006

    Posted 08 Jul 2010 Link to this post

    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  

    How can I do this?
  2. Answer
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 08 Jul 2010 Link to this post


    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

  3. DevCraft R3 2016 release webinar banner
Back to Top