Solved

populating Select box in MVC3 view

Posted on 2011-09-12
2
680 Views
Last Modified: 2012-08-13
i want to populate below mentioned html control in MVC3 view can any body tell me how i will populate this control dynamically
i am getting my data in controller

 [HttpGet]
        public JsonResult Gettestdata()
        {  
            var data = ServiceName.Getdata();
            return Json(data, JsonRequestBehavior.AllowGet);
        }

This html control need to populate with above data which is pulling by [HttpGet]
<select id="control_7" name="control_7[]" multiple="multiple" size="5">
                              <option value=""></option>
                              <option value="option_1">Option 1</option>
                              <option value="option_2">Option 2</option>

                              <option value="option_3">Option 3</option>
                              <option value="option_4">Option 4</option>
                              <option value="option_5">Option 5</option>
                              <option value="option_6">Option 6</option>
                              <option value="option_7">Option 7</option>
                        </select>
0
Comment
Question by:farjack1
2 Comments
 
LVL 17

Accepted Solution

by:
sonawanekiran earned 500 total points
Comment Utility
Check this http://277hz.co.uk/Blog/Show/10/drop-down-lists-in-mvc--asp-net-

You need to call Gettestdata in ConstructDropDownListOptions method
0
 

Author Comment

by:farjack1
Comment Utility
Actually above i mentioned i am using Select box not Html.DropDownListFor, can you give me exp. for Select box.

Thanks
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

There is a huge demand for CodeIgniter among the PHP web developers due to its dynamic features and benefits these days. It is one of most popular and agile open source PHP framework for creating robust web applications in PHP web development field.…
This article discusses how to create an extensible mechanism for linked drop downs.
The purpose of this video is to demonstrate how to set up the WordPress backend so that each page automatically generates a Mailchimp signup form in the sidebar. This will be demonstrated using a Windows 8 PC. Tools Used are Photoshop, Awesome…
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

743 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now