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

get List values on post

4 Answers 99 Views
Sortable
This is a migrated thread and some comments may be shown as answers.
steve
Top achievements
Rank 1
steve asked on 19 Aug 2014, 10:49 PM
I am not sure how to get the values from the sortable object on the post call.  Does the Viewmodel property have to match the <li> name or I the sortible object name 



               @(Html.Kendo().Sortable()
                        .For("#StandardsDirectives")
                        .ConnectWith("#MyStandardsDirectives")
                        .PlaceholderHandler("placeholder")
                        .Cursor("url('" + Url.Content("~/Content/Curser/closedhand.cur") + "'), default")
                    )

OR

                                       @if (!Equals(Model.Document, null))
                                        {
                                            foreach (var standard in Model.Document.MyStandardsDirectives)
                                            {
                                                <li class="list-item">@Html.Label(standard.Name)</li>
                                            }
                                        }

4 Answers, 1 is accepted

Sort by
0
Alexander Valchev
Telerik team
answered on 21 Aug 2014, 03:28 PM
Hi Steve,

Could you please specify what do you mean by "the values from the sortable object"?

The Sortable widget does not support binding to DataSource and respectively does not load or save data from/to remote service. You should hook up to the change event of the widget and manually extract the values from the HTML.

Regards,
Alexander Valchev
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
steve
Top achievements
Rank 1
answered on 27 Aug 2014, 02:30 PM
What I meant was, the form hold the values for each control, how do I get the values for the list items that I have connected to the sortable control.  I will look into the change event but are the values not on the form? Seems like with the change event I would have to store the object in some object until I am ready to push my changes to the server.
0
Petyo
Telerik team
answered on 29 Aug 2014, 11:09 AM
Hello Stephen,

this is correct - you should use the change event to update the values of some hidden input fields to match the order of the items in case you need to submit them with a form. Several related code samples are available in the following help article.

Regards,
Petyo
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
steve
Top achievements
Rank 1
answered on 02 Sep 2014, 01:57 PM
Yes, that makes sense.  Thanks
Tags
Sortable
Asked by
steve
Top achievements
Rank 1
Answers by
Alexander Valchev
Telerik team
steve
Top achievements
Rank 1
Petyo
Telerik team
Share this question
or