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
e.g.
ProductType:
ID
Name
Product:
ProductID
ProductName
ProductType
Product Product Type
Peas Vegetable
Melon Fruit
4 Answers, 1 is accepted
0
Hello John,
You can start from this example and update the following:
You can find more details about running the ASP.NET MVC sample application here.
Regards,
Atanas Korchev
Telerik
You can start from this example and update the following:
- Change the edit mode to GridEditMode.PopUp
.Editable(editable => editable.Mode(GridEditMode.PopUp)) - Remove the toolbar.Save() command
- Remove Batch(true)
- Remove ServerOperations(false)
- 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
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:
Hope this helps.
Regards,
Konstantin Dikov
Telerik by Progress
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.