• USA : +1 973 910 5725
  • INDIA: +91 905 291 3388
  • info@tekslate.com
  • Login

MVC HTML helper class controllers

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 (”C#.net”);

L2.add (”C”);

L2.add (”ASP.net”);

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

Samples

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

For indepth understanding click on

Summary
Review Date
Reviewed Item
MVC HTML helper class controllers
Author Rating
5

“At TekSlate, we are trying to create high quality tutorials and articles, if you think any information is incorrect or want to add anything to the article, please feel free to get in touch with us at info@tekslate.com, we will update the article in 24 hours.”

0 Responses on MVC HTML helper class controllers"

Leave a Message

Your email address will not be published. Required fields are marked *

Site Disclaimer, Copyright © 2016 - All Rights Reserved.