Click here to Skip to main content
15,889,216 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
here i want to diplay list of name and near that side one check box will be thre

suppose names are coming in a list

alex
raj
joseph
jena

so my output will come

checkbox1 alex
checkbox2 raj
checkbox3 joseph
checkbox4 jena
Posted
Comments
F-ES Sitecore 2-Feb-16 7:00am    
This is pretty basic. Go through tutorials on MVC, or better still go through a book on it, and how you do these things will become clear.

1 solution

Pass your list as a parameter to the view using ViewBag
and then in the view:
@foreach(string list in ViewBag.List)
{
@Html.CheckBox("chbxName");@list.ToString();
<br/>
}
//You can create an integer variable and increment its value for each loop and append it to your checkbox control as its name.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900