How to send dropdown selected value to asp.net mvc controller - asp.net

How can i use dropdown selected value to asp.net mvc controller for filling another dropdown

There's a handy blog post here regarding cascading dropdowns:
http://stephenwalther.com/blog/archive/2008/09/07/asp-net-mvc-tip-41-creating-cascading-dropdown-lists-with-ajax.aspx
I'd suggest using jQuery to return a JSON result from the controller with the data for the next dropdown. This isn't great for accessibility but even in WebForms Javascript is used to postback DropDownList controls anyway.

Related

How to develop Editable dropdownlist(Selection list) in asp.net mvc3 with out using Jquery ,Ajax

I want to do Dropdownlist in my application .it should allow user to select and enter value into that.So please try help me how to do Editable Dropdown list with out using Jquery and Ajax
Thanks

Bind a dropdownlist inside the Layout View

I am an ASP.NET WebForms programmer and I'm very new to ASP.NET MVC3. I've got a dropdownlist inside the _Layout view and it needs to be populated on all the pages. I don't want to have to call some code inside every Controller, so I've moved the dropdownlist in a Partial View and put it on the page using #Html.Partial("_DropDownList"). Do I need to create a controller for this View? If so, how can I specify control it needs to use?
You might want to look at #Html.Action and #Html.RenderAction. They allow you to reference a controller action and return the output.

Web user control in asp .Net page

i have a dropdown control with Listitems in Web User control. Am using the web user control in an asp .net page. using find control am able to find the control dropdown but could not get the itemlist. Can any body help me to resolve the issue...?
You should not need to use find control. Expose it as a property of your web user control instead.
If you still want to use FindControl, it is likely you can not find the item list because FindControl does not return a DropdownList. You will need to cast the control returned as a DropDownList to access its Items property

Detecting client-side DOM changes server-side in ASP.NET: Is It Possible?

I'm working on developing a custom control to select items from a predefined list. This is accomplished via 2 ASP.NET ListBox controls, with a few buttons to trigger the movement of ListItems from one ListBox to the other (lets call these ListBoxes lstSelected and lstDeselected).
This is easy enough to do in ASP.NET or JavaScript independently: I have both working. However, if modifications are made via JavaScript, ASP.NET retains no knowledge of this. Is there any way to register the creation of of options in a select tag without AJAX?
You could also do this with traditional postbacks, it doesn't have to be ajax. The postbacks would be triggered by clicking your buttons which change which items are in which listboxes.
You could have a couple of hidden fields, say hdnHasSelectedChanged and hdnHasDeselectedChanged, and set those fields in your javascript code. Then, when a postback really happens, your code-behind can read those hidden fields to detect if changes occurred.

injection user control depending on radio button choice (ASP.NET MVC)

I have this Create Event form (asp.net mvc), and i have to change some parts of the form, depending on user's choice. When the user clicks radio buttons, different user controls (ascx files) should be injected inside the form hopefully using Ajax. Any suggestions to do this?
If you use jQuery you can easily update your form with an ascx or partial html.
The following link could help you further
Wrap your buttons inside forms that are submitted via AJAX (Ajax.BeginForm...). Have the click event submit the form. Using Ajax.BeginForm you can specify the container to be updated with content (UpdateTargetId in the AjaxOptions). Have the form submit to a controller than returns a PartialViewResult based on the form parameters submitted (button values).
If you could have the functionality triggered by links, this is even easier. Just use Ajax.ActionLink and specify the route values necessary to get the proper content. You could, of course, style the links to look like buttons, even radio buttons though that would require some graphics, probably.

Resources