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.
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.
Hi,
I'm just checking if you have managed to resolve your issue.
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 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.