This question is locked. New answers and comments are not allowed.
We have Combobox/Dropdown control inside
@using(Html.BeginForm("Action1", "Controller")){
........search controls (text box, dropdown etc) ....
<input type="submit" id="btnId" value="Submit" />
}
Controller:
[HttpPost]
public ActionResult Action1(SearchViewModel viewModel){
..... How to get Selected Dropdown value?
}
@using(Html.BeginForm("Action1", "Controller")){
........search controls (text box, dropdown etc) ....
<input type="submit" id="btnId" value="Submit" />
}
Controller:
[HttpPost]
public ActionResult Action1(SearchViewModel viewModel){
..... How to get Selected Dropdown value?
}
7 Answers, 1 is accepted
0
nachid
Top achievements
Rank 1
answered on 26 Apr 2011, 08:00 AM
in your SearchViewModel, there should be a property with the same name as your Combobox/Dropdown control
MVC will automatically bind them togother
MVC will automatically bind them togother
0
Hi Tejas,
Atanas Korchev
the Telerik team
In addition you can check this example which shows a working implementation.
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
Ashok
Top achievements
Rank 1
answered on 26 Apr 2011, 03:20 PM
As shown in working implementation, I can't get value of Selected Value of Dropdown/Combobox in Controller. Any idea?
0
Hi Tejas,
Regards,
Atanas Korchev
the Telerik team
I do not understand what you mean. The linked example shows how to get the value of the combobox:
<%= Html.Telerik().ComboBoxFor(x => x.ProductID)%>[AcceptVerbs(HttpVerbs.Post)]public ActionResult ClientValidation(ProductDto dto){ if (ModelState.IsValid) { ViewData["productID"] = dto.ProductID; } return View(dto);}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
Ashok
Top achievements
Rank 1
answered on 27 Apr 2011, 02:42 PM
I think I go the answer.. you are using List<product> to tie to Dropdown/Combobox. I am using SelectListItem. This may be the cause I am not getting value. Is there a way I can get SelectListItem in controller for a Dropdown/Combobox?
0
Hello Tejas,
Atanas Korchev
the Telerik team
I am sorry but I still do not understand what the problem is. Could you send us some sample code which we could look at?
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
Ashok
Top achievements
Rank 1
answered on 27 Apr 2011, 03:25 PM
Hi Atanas,
I am in middle of some changes, if it doesn't work, I will send you sample.
I am in middle of some changes, if it doesn't work, I will send you sample.