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

DropDownList Custom DataSource not firing success

1 Answer 172 Views
DropDownList
This is a migrated thread and some comments may be shown as answers.
Monika
Top achievements
Rank 1
Monika asked on 17 Nov 2015, 11:04 AM

Hi, I am creating a dropdownlist as follows:

Create Widget:

html.Kendo().DropDownList().Name(widgetName).DataSource(source =>
                {
                    source.Custom().Transport(new
                    {
                        read = new Kendo.Mvc.ClientHandlerDescriptor() { HandlerName = "GetPromptData" }
                    });
                }).HtmlAttributes(new { id = widgetName, selectId = RegexHelper.GetIndex(parameter) })

 GetPromptData:

 

function GetPromptData(options) {
    $.ajax({
        url: "FileSubmit/GetPromptData",
        datatype: "jsonp",
        data: {
            "selectId": $('#widgetName').attr("selectid"),
            "key": window.dataKey
        },
        contentType: 'application/json',
        success: function (data) {
            alert("Data is received");
            options.success(data);
        }
    });
}

 And finally my controller:

public JsonResult GetPromptData(string selectId, string key)
{
   List<string> items = new List<string>();
   items.Add("item1");
   items.Add("item2");
   return Json(items, JsonRequestBehavior.AllowGet);
}
  

The ajax call receives a response but from there nothing happens?

html.Kendo().DropDownList().Name(normalisedParameter).DataSource(source =>
                {
                    source.Custom().Transport(new
                    {
                        read = new Kendo.Mvc.ClientHandlerDescriptor() { HandlerName = "GetPromptData" }
                    });
                }).HtmlAttributes(new { id = normalisedParameter, selectId = RegexHelper.GetIndex(parameter) })
html.Kendo().DropDownList().Name(normalisedParameter).DataSource(source =>
                {
                    source.Custom().Transport(new
                    {
                        read = new Kendo.Mvc.ClientHandlerDescriptor() { HandlerName = "GetPromptData" }
                    });
                }).HtmlAttributes(new { id = normalisedParameter, selectId = RegexHelper.GetIndex(parameter) })
html.Kendo().DropDownList().Name(normalisedParameter).DataSource(source =>
                {
                    source.Custom().Transport(new
                    {
                        read = new Kendo.Mvc.ClientHandlerDescriptor() { HandlerName = "GetPromptData" }
                    });
                }).HtmlAttributes(new { id = normalisedParameter, selectId = RegexHelper.GetIndex(parameter) })
html.Kendo().DropDownList().Name(normalisedParameter).DataSource(source =>
                {
                    source.Custom().Transport(new
                    {
                        read = new Kendo.Mvc.ClientHandlerDescriptor() { HandlerName = "GetPromptData" }
                    });
                }).HtmlAttributes(new { id = normalisedParameter, selectId = RegexHelper.GetIndex(parameter) })
html.Kendo().DropDownList().Name(normalisedParameter).DataSource(source =>
                {
                    source.Custom().Transport(new
                    {
                        read = new Kendo.Mvc.ClientHandlerDescriptor() { HandlerName = "GetPromptData" }
                    });
                }).HtmlAttributes(new { id = normalisedParameter, selectId = RegexHelper.GetIndex(parameter) })
html.Kendo().DropDownList().Name(normalisedParameter).DataSource(source =>
                {
                    source.Custom().Transport(new
                    {
                        read = new Kendo.Mvc.ClientHandlerDescriptor() { HandlerName = "GetPromptData" }
                    });
                }).HtmlAttributes(new { id = normalisedParameter, selectId = RegexHelper.GetIndex(parameter) })
html.Kendo().DropDownList().Name(normalisedParameter).DataSource(source =>
                {
                    source.Custom().Transport(new
                    {
                        read = new Kendo.Mvc.ClientHandlerDescriptor() { HandlerName = "GetPromptData" }
                    });
                }).HtmlAttributes(new { id = normalisedParameter, selectId = RegexHelper.GetIndex(parameter) })
html.Kendo().DropDownList().Name(normalisedParameter).DataSource(source =>
                {
                    source.Custom().Transport(new
                    {
                        read = new Kendo.Mvc.ClientHandlerDescriptor() { HandlerName = "GetPromptData" }
                    });
                }).HtmlAttributes(new { id = normalisedParameter, selectId = RegexHelper.GetIndex(parameter) })
html.Kendo().DropDownList().Name(normalisedParameter).DataSource(source =>
                {
                    source.Custom().Transport(new
                    {
                        read = new Kendo.Mvc.ClientHandlerDescriptor() { HandlerName = "GetPromptData" }
                    });
                }).HtmlAttributes(new { id = normalisedParameter, selectId = RegexHelper.GetIndex(parameter) })
html.Kendo().DropDownList().Name(normalisedParameter).DataSource(source =>
                {
                    source.Custom().Transport(new
                    {
                        read = new Kendo.Mvc.ClientHandlerDescriptor() { HandlerName = "GetPromptData" }
                    });
                }).HtmlAttributes(new { id = normalisedParameter, selectId = RegexHelper.GetIndex(parameter) })

1 Answer, 1 is accepted

Sort by
0
Georgi Krustev
Telerik team
answered on 19 Nov 2015, 09:06 AM
Hello Monika,

I tried to replicate the issue locally, but to no avail. Check the screencast that I took during my local test: Could you send us a repro demo?

Regards,
Georgi Krustev
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
Tags
DropDownList
Asked by
Monika
Top achievements
Rank 1
Answers by
Georgi Krustev
Telerik team
Share this question
or