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

Issue with Grid In Form Submit of DateTime and ForeignKeyColumn

2 Answers 172 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Venkatesh
Top achievements
Rank 1
Venkatesh asked on 30 Jan 2013, 12:24 PM
We are using Kend Web Grid in Razor views and we are not able to submit the data to the controller from the Grid in the form. I have attached the screen shot of the Grid while editing.

As you can see we need to collect the details like OrderDate (DateTime), ShipCountry and Employee ID (Foreign Key Column).

We are following your sample project "378389_GridInForm" to submit the Grid data through Hidden controls. The issue we have is when we enter the date and submit the date, format  of Date shown in the grid is "Tue Jan 22 00:00:00 UTC+0530 2013" which .Net is not able to parse to DateTime when using TryUpdateModel.

Another issue with ForeignKey column is when we select an option from the DropDown and click on the Update button the Selected Items Value (ID) is shown in the grid. We need to show the Selected Item's text in the Grid but assign the ID to the hidden control associated with the column.

We have attached the Model, View and Controller files for your review. Can you please guide how to use the Kendo Grid for our requirement. I know we have Kendo Specific commands for Insert, Update to update the Grid Values into Model, but, the sample we are working is for testing only Grid. We have UI scenarios where Grid is just one part of the Form and we have many other data inputs that we take.

We need to demo our POC as early as possible and any quick assistance will be of great help.

2 Answers, 1 is accepted

Sort by
0
Venkatesh
Top achievements
Rank 1
answered on 30 Jan 2013, 12:44 PM
I just found that we can have Client Template as follows to format the selected Date in the hidden control,

.ClientTemplate("#=kendo.format('{0:d}', kendo.parseDate(SomeProp.Date))#")

Can you please guide us about the ForeignKey column issue?
0
Petur Subev
Telerik team
answered on 01 Feb 2013, 09:31 AM
Hello Venkatesh,

Basically you need to create function which can return the text for a given record. For convenience I created a project which you can find in the attached files.

I hope this helps.

Kind Regards,
Petur Subev
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
Tags
Grid
Asked by
Venkatesh
Top achievements
Rank 1
Answers by
Venkatesh
Top achievements
Rank 1
Petur Subev
Telerik team
Share this question
or