mobileNavlogo
headerlogo

User entered data in text box

21 September, 2018

Ratings

Related Blogs

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

 

About Author
Authorlogo
Name

TekSlate

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 .