Posting form data to another page

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Hamayun Khan
    New Member
    • Aug 2007
    • 106

    Posting form data to another page

    Hi

    I have Two pages Default.aspx and Default2.aspx

    Default.aspx has the following code


    <%@ Page Language="VB" MasterPageFile= "~/Main.master" AutoEventWireup ="false" CodeFile="Defau lt.aspx.vb" Inherits="_Defa ult" title="Untitled Page" %>
    <asp:Content ID="Content1" ContentPlaceHol derID="ContentP laceHolder1" Runat="Server">

    <form id="searchform " runat=server action=Default2 .aspx method=post>
    First Name :: <asp:TextBox ID="Name" runat=server ></asp:TextBox>
    Last Name :: <asp:TextBox ID="Lname" runat=server></asp:TextBox>
    <asp:Button UseSubmitBehavi or=true runat=server />
    </form>

    </asp:Content>

    and Default2.aspx has label control and Default2.aspx.v b has the following code

    <%

    Partial Class Default2
    Inherits System.Web.UI.P age

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArg s) Handles Me.Load
    Label1.Text = Request.Form("N ame")
    End Sub
    End Class

    %>

    but this doesn't work.
    I don't know how i get the form data. Please Help.
  • LorenVS
    New Member
    • Mar 2008
    • 8

    #2
    Hello,

    I can't say for 100%, but my best bet is that ASP.NET is not using you're literal ID's on the client, so the post back to Default2.aspx uses different names for your form fields...

    You may want to open up the source of Default.aspx, find the <input> tags and check their name properties, since that is what you will have to use within the Request.Form("x xx") function...

    Hope thats the case,

    - Loren Van Spronsen

    Comment

    • Hamayun Khan
      New Member
      • Aug 2007
      • 106

      #3
      Thanks for Help.

      It is working well for one page. I have to post form data from more than one page. In that case the ids are auto generated and they are not same on different pages.

      I m new to asp.net. I don't know how to use session in asp.net if someone give me some hints about session i can store the values on click event of button to session variables.

      Comment

      Working...