MVC Grid Wrapper with Popup Editing and Dropdown

5 posts, 0 answers
  1. Paul
    Paul avatar
    4 posts
    Member since:
    Mar 2011

    Posted 30 Jun 2014 Link to this post

    Could someone provide or point me to a working example of how to popup add and edit a grid item that also contains a foreign key.
    e.g.

    ProductType:
    ID
    Name

    Product:
    ProductID
    ProductName
    ProductType

    Product            Product Type
    Peas                Vegetable
    Melon               Fruit

  2. Atanas Korchev
    Admin
    Atanas Korchev avatar
    8462 posts

    Posted 02 Jul 2014 Link to this post

    Hello John,

    You can start from this example and update the following:
    1. Change the edit mode to GridEditMode.PopUp
      .Editable(editable => editable.Mode(GridEditMode.PopUp))
    2. Remove the toolbar.Save() command
    3. Remove Batch(true)
    4. Remove ServerOperations(false)
    5. Open the ProductViewModel class and set its UIHint attribute to GridForeignKey
        [UIHint("GridForeignKey")]
        public int? CategoryID { get; set; }

    You can find more details about running the ASP.NET MVC sample application here

    Regards,
    Atanas Korchev
    Telerik
     

    Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

     
  3. Paul
    Paul avatar
    4 posts
    Member since:
    Mar 2011

    Posted 09 Jul 2014 in reply to Atanas Korchev Link to this post

    Thank You, Atanas
  4. Paul
    Paul avatar
    1 posts
    Member since:
    Jul 2008

    Posted 23 Feb 2017 Link to this post

    I am using this technique and it is mostly working nicely so far. Is there any way, however, to make the primary key column read only (or hidden) during the popup editing and when adding new records? Even though I have marked the field using model.Field.Editabled(false) is actually allows the user to edit it (even though changes are ignored). I also wouldn't mind hiding it.
  5. Konstantin Dikov
    Admin
    Konstantin Dikov avatar
    2466 posts

    Posted 27 Feb 2017 Link to this post

    Hi Paul,

    The generated PopUp form will render all fields from the model, but you can prevent certain field from being included by setting the ScaffoldColumn attribute to "false" in the model:
    [ScaffoldColumn(false)]
    public int ProductID
    {
        get;
        set;
    }

    Hope this helps.


    Regards,
    Konstantin Dikov
    Telerik by Progress
    Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
Back to Top