get List values on post

5 posts, 0 answers
  1. steve
    steve avatar
    81 posts
    Member since:
    Oct 2009

    Posted 19 Aug 2014 Link to this post

    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>
                                                }
                                            }
  2. Alexander Valchev
    Admin
    Alexander Valchev avatar
    2875 posts

    Posted 21 Aug 2014 Link to this post

    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.

     
  3. UI for ASP.NET MVC is VS 2017 Ready
  4. steve
    steve avatar
    81 posts
    Member since:
    Oct 2009

    Posted 27 Aug 2014 in reply to Alexander Valchev Link to this post

    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.
  5. Petyo
    Admin
    Petyo avatar
    2439 posts

    Posted 29 Aug 2014 Link to this post

    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.

     
  6. steve
    steve avatar
    81 posts
    Member since:
    Oct 2009

    Posted 02 Sep 2014 in reply to Petyo Link to this post

    Yes, that makes sense.  Thanks
Back to Top
UI for ASP.NET MVC is VS 2017 Ready