Sponsored Ad

Friday, May 28, 2010

How to Get Form Values using ASP-C# | Post Mehtod Example

How to Get Form Values using ASP-C# | Post Mehtod Example

 

This simple asp-C# code will help you to get the form values with post mehtod. Assign the current page name into action="Default3.aspx" property of form and fill the text box with some values and click the submit button.

You can recieve the textbox values using

strValue=Request.Form["txtValue"];

where txtValue is the name of TextBox.

 

How to Get Form Values using ASP-C# | Post Mehtod Example:

 

<%@ Page Language="C#" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" >

<html>
<body>
<form action="Default3.aspx" method="post">
Your name: <input type="text" name="txtValue" size="20">
<input type="submit" value="Submit">
</form>
<%
string strValue;
strValue=Request.Form["txtValue"];
if( strValue != "")
    {
      Response.Write("Value of TextBox is: <b> " + strValue + " </b><br />");
      Response.Write(" Do you Like it ? ");
    }

%>
</body>
</html>

No comments:

Post a Comment

Sponsored Ad

Development Updates