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

Cascading combo boxes and timed out authentication

3 Answers 107 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
Martin
Top achievements
Rank 1
Martin asked on 15 Jan 2014, 03:52 PM
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>

3 Answers, 1 is accepted

Sort by
0
Vladimir Iliev
Telerik team
answered on 17 Jan 2014, 08:55 AM
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!
0
Martin
Top achievements
Rank 1
answered on 17 Jan 2014, 12:39 PM
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?
0
Vladimir Iliev
Telerik team
answered on 21 Jan 2014, 12:31 PM
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!
Tags
ComboBox
Asked by
Martin
Top achievements
Rank 1
Answers by
Vladimir Iliev
Telerik team
Martin
Top achievements
Rank 1
Share this question
or