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

Mapping Binding JSON output to ComboBox Text and Value

0 Answers 44 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.
michael
Top achievements
Rank 2
michael asked on 09 May 2011, 01:57 PM
I am trying to use an external web service that returns a JSON string to populate my ComboBox.

How can I map the fields in the JSON string to the required ComboBox fields?

The JSON string returns pairs of CODE and DESCRIPTION...

Here is my code:
in my ASPX file:
               <% Html.Telerik().ComboBox()
                       .Name("cbRefTables")
                       .DataBinding(b => b
                           .Ajax()
                           .Select("_GetCALMdata", "Common")
                       )
                       .Render();
                %>

in my Controller file:

        public ContentResult _GetCALMdata(string text)
        {
            CALMwsP.wsCALMSoapClient wsC = new CALMwsP.wsCALMSoapClient("wsCALMSoap");
            string resultset = wsC.GetRefTables("MyUserID", "MyDB", "MyWorkstation", "MyApp");
            return Content(resultset, "application/json");
        }

        public ActionResult Index()
        {
            return View();
        }

Also how can I specify the empty Message string?

OS: XP
Telerik Version: ASPNET_MVC_2011_1_315_OpenSource
Language:  C#
Visual Studio 2010 Professional  Version 10.0.30319.1
,Net Framework: Version 4.0.30319
Browser: Firefox 4.0.1

Tags
ComboBox
Asked by
michael
Top achievements
Rank 2
Share this question
or