Change the editable text box to a drop box when editing a RadGrid Column

2 posts, 0 answers
  1. Calin
    Calin avatar
    12 posts
    Member since:
    Feb 2019

    Posted 15 Jul Link to this post

    I have a rad grid displaying info, a list of keys assigned to employees. Once a key is added in the list, the ONLY thing in the future that should be editable is the status column, which there will only be 3 options: lost, Found and Reassigned, and Assigned. Since there are only 3 options I want there, I do not want a text box for them to edit whatever status they want, only these options. I would like the text box to be a drop down list, if possible. I cannot figure out how to change this through any settings though, is this something that needs done in the code behind? 

     

    Attached is a picture for reference. 

  2. Attila Antal
    Admin
    Attila Antal avatar
    346 posts

    Posted 18 Jul Link to this post

    Hi Calin,

    I understand that you would like the Insert Form to be different from the Edit Form, is that correct? If that is the case, you can use Custom Edit Forms with WebUserControls for each edit mode. When the Button is clicked it fires the event Insert or Edit, and in the ItemCommand event handler, you can swap the WebUserControl used by the Grid to insert/Edit the items.

    Example:


    protected void RadGrid1_ItemCommand(object sender, GridCommandEventArgs e)
    {
        if(e.CommandName == RadGrid.InitInsertCommandName)
        {
            RadGrid1.MasterTableView.EditFormSettings.UserControlName = "InsertFormUserControl.ascx";
        }else if(e.CommandName == RadGrid.EditCommandName)
        {
            RadGrid1.MasterTableView.EditFormSettings.UserControlName = "EditFormUserControl.ascx";
        }
    }

    See alo:
    Please let me know if you have any questions.

    Kind regards,
    Attila Antal
    Progress Telerik
    Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
Back to Top