This question is locked. New answers and comments are not allowed.
Is there a way I can pass a Data Services (Astoria) url to the ComboBox? I'm guessing I may have to populate manually. I created a Service Operation that takes a string and the url is something like /DataService/MethodName?param='someParam' and passed to the WebService.Select("~/DataService/MethodName") but the service dosn't like it. I can grab the data with jQuery ($.getJSON("...") so how can I populate from this? I'm wanting similar functionality to the asp.net Ajax ComboBox (http://demos.telerik.com/aspnet-ajax/combobox/examples/populatingwithdata/autocompletesql/defaultcs.aspx)
Will you support templates in the future to enable html items?
Will you support templates in the future to enable html items?
9 Answers, 1 is accepted
0
Hi Axe,
You can try to set WebService URL and wire OnDataBinding event. Thus in its handler you can add your string parameter to the web service URL. Check this online demo - "onComboBoxDataBinding" event handler.
If you still need to load data with $.ajax, you can call component.dataBind() method and pass the returned collection of JSON object. This online demo shows how dataBind method is used.
All the best,
Georgi Krustev
the Telerik team
You can try to set WebService URL and wire OnDataBinding event. Thus in its handler you can add your string parameter to the web service URL. Check this online demo - "onComboBoxDataBinding" event handler.
If you still need to load data with $.ajax, you can call component.dataBind() method and pass the returned collection of JSON object. This online demo shows how dataBind method is used.
All the best,
Georgi Krustev
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
Axe
Top achievements
Rank 1
answered on 15 Sep 2010, 12:17 AM
[WebGet]
public
IQueryable<
string
> SearchPostcode(
string
text)
{
return
this
.CurrentDataSource.Postcodes.Where(p => p.Suburb.StartsWith(text, System.StringComparison.OrdinalIgnoreCase)).OrderBy(p => p.Suburb).Select(p => p.Suburb);
}
POST http://localhost.:45946/odata.svc/SearchPostcode HTTP/1.1
x-requested-with: XMLHttpRequest
Accept-Language: en-au
Referer: http://localhost.:45946/
Accept: text/plain, */*
Content-Type: application/json; charset=utf-8
Accept-Encoding: gzip, deflate
User-Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; WOW64; Trident/4.0; GTB6.5; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; .NET4.0C; InfoPath.3; .NET4.0E)
Host: localhost.:45946
Content-Length: 12
Connection: Keep-Alive
Pragma: no-cache
{"text":"w"}
Here is the html markup, javascript & WCF Data Services Service Operation:
<%= Html.Telerik().AutoComplete()
.Name("AutoComplete")
.DataBinding(binding =>
binding.WebService().Select("~/odata.svc/SearchPostcode"))
.HighlightFirstMatch(true)
.ClientEvents(events => events.OnDataBinding("onComboBoxDataBinding"))
.AutoFill(true)
%>
function
onComboBoxDataBinding(e) {
e.data = $.extend({}, e.data);
}
It works fine in the browser when I use http://localhost.:45946/odata.svc/SearchPostcode?text='wil'
Can you see if you can bind the ComboBox to the your own feed: http://tv.telerik.com/services/odata.svc/ as an example?
0
Hello Axe,
Thank you for getting back to us.
We have got an example which shows how to bind autocomplete UI component to WCF server. I will suggest you examine it and let me know if we can be of a further assistance.
All the best,
Georgi Krustev
the Telerik team
Thank you for getting back to us.
We have got an example which shows how to bind autocomplete UI component to WCF server. I will suggest you examine it and let me know if we can be of a further assistance.
All the best,
Georgi Krustev
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
Sörnt Poppe
Top achievements
Rank 1
answered on 13 Jul 2011, 08:58 AM
I have the very same situation.
Versions:
NET 4.0
MVC 3
Telerik MVC 2011.1.622.340
I would like to use a WCF Service as RESTfull service (Not a controller).
I have this simple Service operation (note the [WebGet]):
I configured the DropDownList this way:
Than I get "Error! The requested URL returned 405 - error"
If I change the WCF Service method attribute to:
[WebInvoke(UriTemplate = "UnusedWorldLanguages", Method = "POST", ResponseFormat = WebMessageFormat.Json)]
It is working.
But that is not very RESTfull.
I would like to setup the DropwDownList() like that (note the Ajax binding and the parameter value for the Select ):
That way I can use my web-service method as I original wrote.
Can I get that please ;-)
Kind regards,
Sörnt
Versions:
NET 4.0
MVC 3
Telerik MVC 2011.1.622.340
I would like to use a WCF Service as RESTfull service (Not a controller).
I have this simple Service operation (note the [WebGet]):
[WebGet(UriTemplate =
"UnusedWorldLanguages"
)]
public
IEnumerable<SelectListItem> GetUnusedWorldLanguages()
{
var items =
new
List<SelectListItem> {
new
SelectListItem() { Text =
"Hello"
, Value =
"World"
} };
return
items;
}
}
I configured the DropDownList this way:
@(Html.Telerik().DropDownList()
.Name("WcfDropDownList")
.DataBinding(dataBinding => dataBinding.WebService().Select("~/API/Language/UnusedWorldLanguages"))
)
Than I get "Error! The requested URL returned 405 - error"
If I change the WCF Service method attribute to:
[WebInvoke(UriTemplate = "UnusedWorldLanguages", Method = "POST", ResponseFormat = WebMessageFormat.Json)]
It is working.
But that is not very RESTfull.
I would like to setup the DropwDownList() like that (note the Ajax binding and the parameter value for the Select ):
<%= Html.Telerik().DropDownList()
.Name("AjaxDropDownList")
.DataBinding(binding => binding.Ajax().Select("~/API/Language/UnusedWorldLanguages"))
%>
That way I can use my web-service method as I original wrote.
Can I get that please ;-)
Kind regards,
Sörnt
0
Hello Sörnt,
Georgi Krustev
the Telerik team
ComboBox, as other components which support WebService binding, makes POST request to the server, because HTTPGET method is not allowed by default in ASMX web services.
Currently setting just an URL in the Ajax().Select("URL") method is not supported. We have logged your feature request to our product backlog. Depending on the users interest we will determine whether to implement it.
Georgi Krustev
the Telerik team
Register for the Q2 2011 What's New Webinar Week. Mark your calendar for the week starting July 18th and book your seat for a walk through of all the exciting stuff we will ship with the new release!
0
Sörnt Poppe
Top achievements
Rank 1
answered on 14 Jul 2011, 09:48 AM
Thanks for that Georgi.
regards,
Sörnt
regards,
Sörnt
0
James
Top achievements
Rank 1
answered on 08 May 2012, 05:36 PM
Given that all restful services will require a GET not a POST I think this should be incredibly high priority.
You're GETTING data FROM THE SERVER, not POSTING data TO THE SERVER.
Hence since this is MVC.NET and action methods can be get just as surely as anything else this should be a no brainer. And with Web API coming it should be a requirement to handle this.
And you should go through ALL other web service requests and make sure that you're using the right methods for everything so that it is purely restful or at least can be specified in config to use REST rules by default)
You're GETTING data FROM THE SERVER, not POSTING data TO THE SERVER.
Hence since this is MVC.NET and action methods can be get just as surely as anything else this should be a no brainer. And with Web API coming it should be a requirement to handle this.
And you should go through ALL other web service requests and make sure that you're using the right methods for everything so that it is purely restful or at least can be specified in config to use REST rules by default)
0
Sörnt Poppe
Top achievements
Rank 1
answered on 08 May 2012, 05:54 PM
+1
The current behaviour is really outdated.
The current behaviour is really outdated.
0
James
Top achievements
Rank 1
answered on 08 May 2012, 05:55 PM
... and all controls should support getting back a json object or a json array of objects.
And they should support Odata as well, while getting back either odata json or a pure json array.
And they should support Odata as well, while getting back either odata json or a pure json array.