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

[Solved] ComboBox Autocomplete Ajax Error 500

3 Answers 116 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Steve
Top achievements
Rank 1
Steve asked on 12 Jul 2011, 02:27 AM
Hi,

  I'm using release 2011.1.315 and I have a problem with an Ajax ComboBox filterable bound in my telerik Grid.  When the result from filter entered by user return nothing, I got an error 500.  could you help me please?

<% var controlName = ViewData.TemplateInfo.GetFullHtmlFieldName(String.Empty);
   Html.Telerik().ComboBox()
   .Name(controlName)
   .DataBinding(binding => binding.Ajax().Select("_InstructeursAjaxLoading", "RapportCours"))
    .Filterable(filtering => filtering.FilterMode(AutoCompleteFilterMode.Contains).MinimumChars(2))
        .HighlightFirstMatch(true)
        .HtmlAttributes(new { style = "width:250px" })
            .Render();
 %>

Thanks

3 Answers, 1 is accepted

Sort by
0
Steve
Top achievements
Rank 1
answered on 12 Aug 2011, 03:08 AM
Hi,

    This problem is still there with release 2011.2.712.

Help me please
Steve
0
Accepted
Atanas Korchev
Telerik team
answered on 12 Aug 2011, 07:01 AM
Hi Steve,

Error 500 means that there is a server side exception in your action method. I suggest you break with the debugger and see what went wrong.

Regards,
Atanas Korchev
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items

0
Steve
Top achievements
Rank 1
answered on 13 Aug 2011, 01:49 AM
Thanks for your help.  I know it is supposed to be a server exception, but server-side code returns ok.  I just found the problem is I didn't filter in ajax loading code.  Here is the full code.

[HttpPost]
public ActionResult _InstructeursAjaxLoading(string text, string contexte)
{
    var instructeur = _container.GetInstructeurs();
 
    var userAuth = this.HttpContext.User.GetAsjIdentity();
    if (text != null)
    {
        instructeur = instructeur.Where((p) => p.Nom.Contains(text));
    }
 
    return new JsonResult
    {
        Data = new SelectList(instructeur.ToList(), "Pk",
            "Nom", contexte == "Secondaire" ? (Guid?)null : userAuth.Pk_MembreId)
    };
}

Those lines are new and has corrected the problem.
if (text != null)
{
    instructeur = instructeur.Where((p) => p.Nom.Contains(text));
}


Thanks
Tags
ComboBox
Asked by
Steve
Top achievements
Rank 1
Answers by
Steve
Top achievements
Rank 1
Atanas Korchev
Telerik team
Share this question
or