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

User entered data in text box

Example to trap the user entered data in text box

Create a new view with the name sample1

Sample 1

 

 6

 

 

Go to source part

Writ the following code to create the design of the form

<div>

<%HTML.begin form();%>

<%=HTML.label(“enter user name”)%>

<%=HTML.text box(“T1”)%></br>

<button id=”B1” type =”submit”>submit</button></br>

<%HTML.end form();%>

Go to home control.cs write code for two action method

[Accept verbs [http verbs.post]]

Public action result sample3 (string B, string T1)

{

View data [“a”]=”user name is:-”+T1;

Return view ();

}

In the above home if user is entering any data in text box T1 and clicking on button B1, then user entered data in text box T1 will be passed to argument “T1” of action method sample3 action method.

Interested in mastering ASP.net?Learn more about ASP.net Tutorial in this blog post.

Example to trap the data to perform the operations:

Create a new view with the name sample2

 7

 

 Write the following code to create the code

<body>

<div>

<h1>welcome to satya technologies</h1>

<%HTML.begin form();%>

<%=HTML.label(“enter first number”)%>

<%=HTML.text box(“T1”)%></br>

<%=HTML.label(“enter second number”)%>

<button id=”B1” type =”submit”>add</button>

<%=HTML.encode (view data [“R”])%>

<%HTML.end form();%>

</div>

</body>

Go to home control.cs write the following code for action method

[Accept verbs (http verbs.post)]

Public action result sample4 (string B1, string T1, string T2)

{

Int c= convert to int3 (T1)+c.to int (T2);

View data [“R”] =”sum is:-”C;

Return view ();

}

Run the application and check.

For indepth understanding click on

 

Summary
Review Date
Reviewed Item
User entered data in text box
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 User entered data in text box"

    Leave a Message

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

    Site Disclaimer, Copyright © 2016 - All Rights Reserved.

    Support


    Please leave a message and we'll get back to you soon.

    I agree to be contacted via e-mail.