HTML helper classes

21 September, 2018

Related Blogs

Working with HTML helpers:

HTML helpers are used to under the HTML controls within the MVC views. 2MVC will support following HTML helpers               Name                                        Syntax
  1. Label                2      label (string text)
  2. Text box          2      textbox (string name, object value)
  3. Password       2    password (string name, object value)
  4. Radio button 2 Radiobutton (string name, object value, bool checked)
  5. Check box     2  checkbox (string name, bool checked)
  6. Drop down list box2Dropdown list (string nmae)
  7. List box          2listbox (string name)
  8. Render action  2Renderaction (string actionname, string control name)
  9. Link button     2action link (string linktext, string action name, string controller name)
  10. Text area        2text area (string name)
  11. HTML encoder  2encode(string text/object value)
  12. Validate          2validate (string model name)
  13. Validate message 2validate message (string model name, string message)
  14. Form                 2Begin form ()
                                3 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 Training? Enroll now for FREE demo on 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 (“”); L2.add (“”); L2.add (“WCF”); L2.add (“AJAX”); View data [“cb1”] = new select list (L1); View data [“cb2”] = new select list (L2); Return view (); }
For indepth understanding click on
About Author


Author Bio

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 .