Form submit value to the save page without action url : Form Self Submit « Development « ASP.Net






Form submit value to the save page without action url

<%@ Page Language="VB" %>
<script runat="server">
    Sub Page_Load(Sender As Object, E As EventArgs)
        If Request.Form("txtName") <> "" Then
            lblSentence.Text = Request.Form("txtName") _
                & " selected " & Request.Form("ddlColor")
        End If
    End Sub
</script>

<html>
<head>
<title>ASP.NET Viewstate Form Sample #1</title>
</head>
<body bgcolor="#FFFFFF">

<form method="post">

    Enter Your Name:
    <input type="text" id="txtName" name="txtName" />

    Pick a Color:
    <select id="ddlColor" name="ddlColor">
        <option>Red</option>
        <option>Orange</option>
        <option>Yellow</option>
        <option>Green</option>
        <option>Blue</option>
        <option>Indigo</option>
        <option>Violet</option>
    </select>

    <input type="submit" id="btnSubmit" text="Submit" />

</form>

<asp:label id="lblSentence" runat="server" />

</body>
</html>
           
       








Related examples in the same category

1.Submitting and displaying form values in ASP.NET