Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 691
  • Last Modified:

populating Select box in MVC3 view

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
farjack1
Asked:
farjack1
1 Solution
 
sonawanekiranCommented:
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
 
farjack1Author Commented:
Actually above i mentioned i am using Select box not Html.DropDownListFor, can you give me exp. for Select box.

Thanks
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Tackle projects and never again get stuck behind a technical roadblock.
Join Now