Solved

populating Select box in MVC3 view

Posted on 2011-09-12
2
681 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
ID: 36527456
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
ID: 36535701
Actually above i mentioned i am using Select box not Html.DropDownListFor, can you give me exp. for Select box.

Thanks
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Download a website to hdd 2 50
Regular Expression 1-100 with two digits 15 23
how would you interpret lines 3 30
Code works but it's slow 24 40
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
Boost your ability to deliver ambitious and competitive web apps by choosing the right JavaScript framework to best suit your project’s needs.
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 invoke it on a web page. 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.: (CODE)

910 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

19 Experts available now in Live!

Get 1:1 Help Now