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

MVC Grid Wrapper with Popup Editing and Dropdown

4 Answers 141 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Paul
Top achievements
Rank 1
Paul asked on 30 Jun 2014, 03:57 PM
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

4 Answers, 1 is accepted

Sort by
0
Atanas Korchev
Telerik team
answered on 02 Jul 2014, 03:22 PM
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.

 
0
Paul
Top achievements
Rank 1
answered on 09 Jul 2014, 06:53 PM
Thank You, Atanas
0
Paul
Top achievements
Rank 1
answered on 23 Feb 2017, 08:07 PM
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.
0
Konstantin Dikov
Telerik team
answered on 27 Feb 2017, 01:56 PM
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.
Tags
Grid
Asked by
Paul
Top achievements
Rank 1
Answers by
Atanas Korchev
Telerik team
Paul
Top achievements
Rank 1
Paul
Top achievements
Rank 1
Konstantin Dikov
Telerik team
Share this question
or