HTML helpers are used to under the HTML controls within the MVC views. MVC will support following HTML helpers Name Syntax
HTML.End form () Working with HTML helper class: Code for dropdown list creating and list box Go to sample view write the following code <%= HTML.label(“select qualification”)%> <%=HTML.DropDownList(“CB1”)%><br%> <%=HTML.label(“select skill set”)%> <%=HTML.listbox(“LB”)> Go to home controller .cs
Interested in ASP.net Training? Enroll now for FREE demo on ASP.net Training.
In sample action method write the following code To add the list of elements to the combo box and list box Public action result sample () { List <string> L1=new list<string> ()} L1.add (“USC”); L1.add (“10+2”); L1.add (“Degree”); List <string> L2=new list <string> (); L2.add (“C#.net”); L2.add (“ASP.net”); L2.add (“WCF”); L2.add (“AJAX”); View data [“cb1”] = new select list (L1); View data [“cb2”] = new select list (L2); Return view (); }
You liked the article?
Like: 0
Vote for difficulty
Current difficulty (Avg): Medium
TekSlate is the best online training provider in delivering world-class IT skills to individuals and corporates from all parts of the globe. We are proven experts in accumulating every need of an IT skills upgrade aspirant and have delivered excellent services. We aim to bring you all the essentials to learn and master new technologies in the market with our articles, blogs, and videos. Build your career success with us, enhancing most in-demand skills in the market.