Cascading combo boxes and timed out authentication

4 posts, 0 answers
  1. Martin
    Martin avatar
    2 posts
    Member since:
    May 2012

    Posted 15 Jan 2014 Link to this post

    Can anyone advise on the recommended approach to cascading combo boxes when the user could be "timed out" from their session when they select from the first list.

    Basically, the first list is populated by being bound to the mvc model on page load.  However, the second is defined to pull data from the server via a json Response.

    The issue is that if, between loading the first page and the user selecting something from that list, the user is timed out of their session the list doesn't get populated, not error is display, and the list is populated with a lot of "undefined" values.

    So, my question is, what's the best practice for handling this situation with kendo mvc?

    here's the code for the view..

    <div class="row">
        <div class="leftbox">
            @Html.LabelFor(m => m.OrganisationId)
        </div>
        <div class="rightbox">
            @(Html.Kendo().ComboBoxFor(m => m.OrganisationId)
                  .BindTo(Model.OrganisationList)
                  .Placeholder("Select Organisation")
                  .Suggest(true)
                  .Filter(FilterType.Contains)
                  .HtmlAttributes(new { @class = "kendoDropdown wideDropdown", selectWidth = "400" }))
        </div>
    </div>
    <div class="row">
        <div class="leftbox">
            @Html.LabelFor(m => m.UserId)
        </div>
        <div class="rightbox">
            @(Html.Kendo().ComboBoxFor(m => m.UserId)
              .Placeholder("Select User")
              .DataSource(source => source.Read(read => read.Action("GetUsers", "Auth").Data("getOrganisationId")).ServerFiltering(true))
              .DataTextField("value")
              .DataValueField("id")
              .HtmlAttributes(new { @class = "kendoDropdown wideDropdown"})
              .Enable(false)
              .AutoBind(false)
              .CascadeFrom("OrganisationId")
          .Events(e => e.Change("enableButton") )
        </div>
  2. Vladimir Iliev
    Admin
    Vladimir Iliev avatar
    2172 posts

    Posted 17 Jan 2014 Link to this post

    Hi Martin,

    Basically handling session timeouts in MVC is not directly related to KendoUI but is a general programming task. There are several ways to do that and which one you would choose depends entirely on you and the exact setup that you have. For example you can check the following help article:

    Regards,
    Vladimir Iliev
    Telerik
    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. Martin
    Martin avatar
    2 posts
    Member since:
    May 2012

    Posted 17 Jan 2014 Link to this post

    Hi Vladimir,

    I'm familiar with handling timeouts in MVC, the issue is the kendo control's ajax request.

    I can find ways around the issue, what I want to know is what is the suggested way to do deal with this.

    However, using your stated example, how would I get the cascaded ajax request (that is performed by the kendo control) to redirect the user if the response is "__login__".

    Do you suggest a global ajax handler that checks every ajax response?
  5. Vladimir Iliev
    Admin
    Vladimir Iliev avatar
    2172 posts

    Posted 21 Jan 2014 Link to this post

    Hi Martin,

    Please note that the error event of the second ComboBox is not triggered as by default when the session is expired, the user redirected to "login" page which doesn't return HTTP error code. More information on the matter is available on various resources over the internet. For example you can check the following help article about how handle the session timeouts differently for Ajax requests (the ComboBox DataSource "Error" event is triggered by either HTTP error code or JSON response that contains "error" field):

    Regards,
    Vladimir Iliev
    Telerik
    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