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.
Hi,
Have you defined the model in your View using the @model directive?
model IQueryable<COMMON.Models.ListingModel>
Can you share a small demo sample?
I'm just checking if you have managed to resolve your issue.
Well i didnt want to use Jquery to post data to the server , so I used MVC Helper to achieve what i wanted :
@(Html.Infragistics().Combo() .InputName("EntityValue") .ID("listingCombo") .Width("270px") //.DataSource(this.Model as IQueryable<COMMON.Models.ListingModel>) .DataSourceUrl(Url.Action("ComboData")) .ValueKey("EntityValue") .TextKey("EntityName") .DataBind() .Render() )
so far so good . I am getting the value on my controller's action method.