This question is locked. New answers and comments are not allowed.
Hello, I need help with RadComboBox in MVC.
I have a list of data which are shown in RadComboBox. When I open EDIT page, I want do see value that was saved (set) before.
This is my html code:
<telerik:RadComboBox runat="server" ID="SelectionId" EnableLoadOnDemand="true" AllowCustomText="true" ShowMoreResultsBox="true" EmptyMessage="Type here ..." Height="100px"
MarkFirstMatch="True">
<WebServiceSettings Path="~/Mailing/" Method="LoadItemsSelections" />
</telerik:RadComboBox>
So, I am using Mailing controller (it is MVC) and I call method LoadItemsSelections when user clicks on RadComboBox.
Initialy, when no item is selected, "Type here ..." text is displayed in RadComboBox.
When I select item and save it, by calling method LoadItemsSelections in Mailing controller, I save that selectionId.
When I edit form, "Type here ..." text is displayed againg, since I can't set value before user clicks on the control. Data is loaded on demand.
Here is LoadItemsSelections code from Mailing controller
[JsonParamFilterAttribute(Parameter = "context", TargetType = typeof(RadComboBoxContext))]
public JsonResult LoadItemsSelections(RadComboBoxContext context)
{
return Json(new { d = result });
}
So, the Question is:
Is there anyway to set that saved Model.SelectionId in RadComboBox on edit?
Or, maybe solution could be to load that list of items on RadComboBox load if Model.SelectionId is set to some value?
How can I do that? What is the best solution?
I need you answer as soon as possible,
Thanks!
Tijana
P.S. By the way, if anyone have problems with MVC and RadComboBox - calling method from controller, this could be solution:
<WebServiceSettings Path="~/Mailing/" Method="LoadItemsSelections" />
I had error "the server method 'LoadItemsSelections' failed" because the code was:
<WebServiceSettings Path="Mailing" Method="LoadItemsSelections" />, but since it is not webservice, but MVC,
solution is to set Path to "~/Mailing/"!!!!
I have a list of data which are shown in RadComboBox. When I open EDIT page, I want do see value that was saved (set) before.
This is my html code:
<telerik:RadComboBox runat="server" ID="SelectionId" EnableLoadOnDemand="true" AllowCustomText="true" ShowMoreResultsBox="true" EmptyMessage="Type here ..." Height="100px"
MarkFirstMatch="True">
<WebServiceSettings Path="~/Mailing/" Method="LoadItemsSelections" />
</telerik:RadComboBox>
So, I am using Mailing controller (it is MVC) and I call method LoadItemsSelections when user clicks on RadComboBox.
Initialy, when no item is selected, "Type here ..." text is displayed in RadComboBox.
When I select item and save it, by calling method LoadItemsSelections in Mailing controller, I save that selectionId.
When I edit form, "Type here ..." text is displayed againg, since I can't set value before user clicks on the control. Data is loaded on demand.
Here is LoadItemsSelections code from Mailing controller
[JsonParamFilterAttribute(Parameter = "context", TargetType = typeof(RadComboBoxContext))]
public JsonResult LoadItemsSelections(RadComboBoxContext context)
{
return Json(new { d = result });
}
So, the Question is:
Is there anyway to set that saved Model.SelectionId in RadComboBox on edit?
Or, maybe solution could be to load that list of items on RadComboBox load if Model.SelectionId is set to some value?
How can I do that? What is the best solution?
I need you answer as soon as possible,
Thanks!
Tijana
P.S. By the way, if anyone have problems with MVC and RadComboBox - calling method from controller, this could be solution:
<WebServiceSettings Path="~/Mailing/" Method="LoadItemsSelections" />
I had error "the server method 'LoadItemsSelections' failed" because the code was:
<WebServiceSettings Path="Mailing" Method="LoadItemsSelections" />, but since it is not webservice, but MVC,
solution is to set Path to "~/Mailing/"!!!!