ok, I got as far as showing stuff in one page, but now pass the content of the asp:textbox to Webform2.aspx and display it in a text box
It was when i added page2 that i struck problems
I can display request.querystring.get('stringname') in the body, but not a txtbox.
 
I get this error  now (note that deleting my web control and adding a new one gives me now no complile errors but this runtime error - hmmmm)
 
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.NullReferenceException: Object reference not set to an instance of an object.

Source Error:

Line 55:   response.Write(request.QueryString.Get('txtpass'));  
Line 57:   txtWeb.Text := request.QueryString.Get('txtpass').ToString;  

Source File: c:\inetpub\wwwroot\WebApplication3\WebForm2.pas    Line: 57

Stack Trace:

[NullReferenceException: Object reference not set to an instance of an object.]
   WebForm2.TWebForm2.Page_Load(Object sender, EventArgs e) in c:\inetpub\wwwroot\WebApplication3\WebForm2.pas:57
   System.Web.UI.Control.OnLoad(EventArgs e) +67
   System.Web.UI.Control.LoadRecursive() +35
   System.Web.UI.Page.ProcessRequestMain() +731
 
i even tried adding this code to no avail (after advise from M$.NET guru):
 
procedure TWebForm2.Page_Load(sender: System.Object; e: System.EventArgs);
var
   txtWeb : System.Web.UI.WebControls.TextBox;
begin
    txtWeb := System.Web.UI.WebControls.TextBox.Create;
   txtWeb.Text := request.QueryString.Get('txtpass').ToString;
end;
 
still the same erorr
 
----- Original Message -----
Sent: Tuesday, February 03, 2004 10:56 AM
Subject: RE: [DUG] display value of form1.txtbox in form2.txtbox

Tracey how about this:

 

---------------------------- Webform1.aspx ----------------------------------------------------------------------

<%@ Page language="c#" Debug="true" Codebehind="WebForm1.pas" AutoEventWireup="false" Inherits="WebForm1.TWebForm1" %>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">

 

<html>

  <head>

    <title></title>

    <meta name="GENERATOR" content="Borland Package Library 7.1">

  </head>

 

  <body ms_positioning="GridLayout">

  <form method=post runat="server">

    <asp:button id=Button1

                style="Z-INDEX: 1; LEFT: 46px; POSITION: absolute; TOP: 134px"

                runat="server" width="83px" height="23" text="Submit">

    </asp:button>

    <asp:textbox id=txtUserName

                 style="Z-INDEX: 2; LEFT: 102px; POSITION: absolute; TOP: 38px"

                 runat="server">

    </asp:textbox>

    <asp:textbox id=txtPassword

                 style="Z-INDEX: 3; LEFT: 102px; POSITION: absolute; TOP: 62px"

                 runat="server" textmode="Password">

    </asp:textbox>

    <asp:label id=Label1

               style="Z-INDEX: 6; LEFT: 22px; POSITION: absolute; TOP: 38px"

               runat="server" font-size="X-Small" font-names="Arial">Username</asp:label>

    <asp:label id=Label2

               style="Z-INDEX: 7; LEFT: 22px; POSITION: absolute; TOP: 62px"

               runat="server" font-size="X-Small" font-names="Arial">Password</asp:label>

    <asp:label id=Label3

               style="Z-INDEX: 8; LEFT: 334px; POSITION: absolute; TOP: 102px"

               runat="server">Label</asp:label>

  </form>

</body>

</html>

 

--------------------------------------------------------- WEBFORM1.PAS --------------------------------------------------------------

 

unit WebForm1;

 

interface

 

uses

  System.Collections, System.ComponentModel,

  System.Data, System.Drawing, System.Web, System.Web.SessionState,

  System.Web.UI, System.Web.UI.WebControls, System.Web.UI.HtmlControls;

 

type

  TWebForm1 = class(System.Web.UI.Page)

  {$REGION 'Designer Managed Code'}

  strict private

    procedure InitializeComponent;

                        procedure Button1_Click(sender: System.Object; e: System.EventArgs);

  {$ENDREGION}

  strict private

    procedure Page_Load(sender: System.Object; e: System.EventArgs);

  strict protected

                        Button1: System.Web.UI.WebControls.Button;

                        txtUserName: System.Web.UI.WebControls.TextBox;

                        txtPassword: System.Web.UI.WebControls.TextBox;

                        Label1: System.Web.UI.WebControls.Label;

                        Label2: System.Web.UI.WebControls.Label;

                        Label3: System.Web.UI.WebControls.Label;

    procedure OnInit(e: EventArgs); override;

  private

    { Private Declarations }

  public

    { Public Declarations }

  end;

 

implementation

 

{$REGION 'Designer Managed Code'}

/// <summary>

/// Required method for Designer support -- do not modify

/// the contents of this method with the code editor.

/// </summary>

procedure TWebForm1.InitializeComponent;

begin

            Include(Self.Button1.Click, Self.Button1_Click);

            Include(Self.Load, Self.Page_Load);

end;

{$ENDREGION}

 

procedure TWebForm1.Page_Load(sender: System.Object; e: System.EventArgs);

begin

  // TODO: Put user code to initialize the page here

end;

 

procedure TWebForm1.OnInit(e: EventArgs);

begin

  //

  // Required for Designer support

  //

  InitializeComponent;

  inherited OnInit(e);

end;

 

procedure TWebForm1.Button1_Click(sender: System.Object; e: System.EventArgs);

begin

            Label3.Text := Request.Params['txtUserName'];

end;

 

 

end.

 

 


From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Tracey Maule
Sent: Tuesday, 3 February 2004 9:38 a.m.
To: NZ Borland Developers Group - Delphi List
Subject: Re: [DUG] display value of form1.txtbox in form2.txtbox

 

O thanks for replying James, I was beginning to wonder if I was doomed to start controversial conversations but never get an answer lol

 

If by ASP.NET controls you mean the "Web Controls", yes I have tried them.  Twice.  And have had different errors each time.

 

Most commonly I get "Undeclared identifier: "txtWhateverItsNamed" on compile.

 


_______________________________________________
Delphi mailing list
[EMAIL PROTECTED]
http://ns3.123.co.nz/mailman/listinfo/delphi
_______________________________________________
Delphi mailing list
[EMAIL PROTECTED]
http://ns3.123.co.nz/mailman/listinfo/delphi

Reply via email to