Handling server errors for ajax bound listview

4 posts, 0 answers
  1. Robert
    Robert avatar
    7 posts
    Member since:
    Jul 2012

    Posted 08 Sep 2012 Link to this post

    I have a listview that is bound to an MVC controller, the view populates fine and pages fine, I would like to enable adding a new listview item so I added a template with a single textbox bound to an autocomplete that also populates from the server. All that works fine, but when I invoke the add on the listview, it is immediatly added to the listview and then the call appears in the controller. If the add executes then all is fine, if not then it is out of sync and there is no way to indicate to the listview to refresh or that an error occured. I have tried returning errors in the  same way a Grid expects them (JSON object with Data, Errors and Total), I have tried simply returning a 500 error, but I cant get seem to figure out how to indicate that the operation failed.

    Attached are the razor view, the editor temmplate and the controller.

    Thanks in advance for any advice


  2. Nikolay Rusev
    Admin
    Nikolay Rusev avatar
    2285 posts

    Posted 13 Sep 2012 Link to this post

    Hello Robert,

    Unfortunately the information is not sufficient to get more complete understanding  on your scenario. Can you provide us with runnable sample so we can assist you further?

    Greetings,
    Nikolay Rusev
    the Telerik team
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
  3. Kendo UI is VS 2017 Ready
  4. Robert
    Robert avatar
    7 posts
    Member since:
    Jul 2012

    Posted 13 Sep 2012 Link to this post

    I can build out a sample if you want to see the specifics, but I have accomodated the issue by callling the dataSource.Read() on the listview in the error handler for the dataSource. Is seems a bit inelegant in that the item first appers on the list, and then we get the error back from the server and the entire listview needs to be rebuilt. Ideally we could have some type of completion processor before the item is added.
  5. Nikolay Rusev
    Admin
    Nikolay Rusev avatar
    2285 posts

    Posted 18 Sep 2012 Link to this post

    Hello Robert,

    Adding item in the DataSource will cause the DataSource to trigger its change event which will result in updating ListView items. This is the behavior that will be observed in every data bound widget.

    Greetings,
    Nikolay Rusev
    the Telerik team
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
Back to Top
Kendo UI is VS 2017 Ready