Can somebody please provide a working sample of igCombo which shows how we can pass the selected value of the combobox to Asp.Net Mvc controller action.
In Asp.net webforms dropdown it iss as easy as getting the value through id of the control. I need to know how we can do that in asp.net mvc. And i dont want to use Jquery or clientside script to do it.
If a user selects a value from combo box that value gets passed as a parameter to another action method of the cotroller. Please provide a sample application that would be really helpful.
Thanks.
Hello,
The IgniteUI controls are completely client-side. They don't work the same way as ASP.NET WebForms controls. So you will have to add some javascript to post to a controller. You can do this in the SelectionChanged event like this:
selectionChanged: function(evt, ui){
//get the value of the selected item
var value = ui.items[0].value;
$.post('controller/action/' + value);
}
Let me know if you have any other questions.
I have the following View:
@using (Html.BeginForm("Submit", "Dashboard", FormMethod.Post, new { @id = "form", @class = "form-horizontal" })) { @(Html.Infragistics().ComboFor(item=>item.EntityName) .Width("270px") //.DataSource(this.Model as IQueryable<COMMON.Models.ListingModel>) .DataSourceUrl(Url.Action("ComboData")) .ValueKey("EntityValue") .TextKey("EntityName") .DataBind() .Render() )
<input id="submitBtn" type="submit" value="Update" />
In Controller:
[HttpPost] public ActionResult Submit(ListingModel listingModel) //On submit click , it is looking for ActionResult Submit(),I want to call Submit(ListingModel listingModel) { // do something }
on submit click I want to pass the model to my action method , but instead of getting model in parameter, the html form is looking for a paramterless action method which means it is not getting the model on post back. why is this happening.
You mean to say that I cannot get the value of the combobox through the submit button of the form. What if I have a complex object that i want to pass to the action method when it is selected from the dropdown. Do i have to use Jquery and first create an object of it on client side. That would be a big problem.