MVC HTML helper class controllers
  • Share this blog:

MVC HTML helper class controllers


Enter user name
Enter user name
Enter pass word
Select gender
  • Male
  • female
Select Hobbies
  • Dancing
  • Playing
Select skills
  • C
  • C++
  • JAVA
Describe your experience

    Go to sample .asp x source path of the page write the follows code in <div> tag <table align= ‘center’ border=”2”> <tr><td><%= HTML.label(“enter your name”)%></td> <td><%=HTML.textbox(“t1”)%></td> </tr> <tr><td><%=HTML.label(“enter user name”)%></td> <tr><td><%=HTML.textbox (“t2”)%></td> </tr> <tr><td><%=HTML.label (”enter password”)%></td> <td><%=HTML.textbox(“t3”)%></td> </tr> <tr><td><%=HTML.label(“text gender”)%></td> <td><%=HTML.radiobutton(“gender”, ”male”)%>male <%-HTML.radiobutton(“gender”, “female”)%>female </td> </tr> <tr><td><%=HTML.label(“select hobbies”)%></td> <td><%=HTML.checkbox(“dancing”)%>dancing <%=HTML.checkbox(“playing”)%>playing > </td> </tr> <tr><td><%=HTML.label (”select qualification”)%></td> <td><%=HTML.dropdownlist (“CB1”)%></td> </tr> <tr><td><%=HTML.label (”select skill set”)%></td> <td><%=HTML.listbox(“LB1”)%></td> </tr> <tr> <td><%=HTML.load (“describe your experience”)%></td> <td><%=HTML2.textbox(“TA!1”)%></td> </tr> </table> </div> </body> </html> Go to home controller .cs 3 Write the following code ---> to display the data in combo box and list box Public action result sample () { List <string> L1=new list <string> (); L1.add (”SSC”); L1.add (”10+2”); L1.add (”Degree”); List <string>L2=new list <string> (); L2.add (””); L2.add (”C”); L2.add (””); View data [“CB1”] =new select list (L1); View data [“LB1”] =new select list (L2); Return view (); }     Redirecting the user request using HTML helper class: To redirect the user request from one page to other page use action link method from HTML helper class.

Sample view


Desired to gain proficiency on ASP.Net?
Explore the blog post on ASP.Net training to become a pro in ASP.Net.

Create new view page with the name samples 3 Go to source part and write the following code <body> <div> <h1>welcome to satya technologies</h1> <%=HTML.actionlink (“sample view”, “sample”,”home”) %> </div> </body> //<%#HTML.actionlink ( “(“sample view”, “sample”,”home”) %> 3                            3                     3 Display text        action name    controller name 2go to home controller create an action method like Public action result sample () { Return view (); } Go to globel. Asax file change action name With samples and run the application Create an action link to redirect user requires to some website


You liked the article?

Like : 0

Vote for difficulty

Current difficulty (Avg): Medium

Recommended Courses


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 in the market.

Stay Updated

Get stories of change makers and innovators from the startup ecosystem in your inbox