Wrox Programmer Forums
Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 2.0 > ASP.NET 2.0 Basics
| Search | Today's Posts | Mark Forums Read
ASP.NET 2.0 Basics If you are new to ASP or ASP.NET programming with version 2.0, this is the forum to begin asking questions. Please also see the Visual Web Developer 2005 forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 2.0 Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
  #1 (permalink)  
Old July 25th, 2007, 12:00 AM
Registered User
 
Join Date: Apr 2007
Location: , , .
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to poogles
Default cross-page posting within pages with master file..

...doesn't work. :)

I'm getting "Object reference not set to an instance of an object."

Code to follow...

page1.aspx:


<%@ Page Language="VB" MasterPageFile="~/main.master" Title="Untitled Page" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">

<form ID="frm1" runat=server defaultbutton="Button1" defaultfocus="TextBox1">
    <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
    <asp:Button ID="Button1" runat="server" Text="Button" PostBackUrl="page2.aspx" />
</form>

</asp:Content>


page2.aspx:


<%@ Page Language="VB" MasterPageFile="~/main.master" Title="Untitled Page" %>

<script runat="server">

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs)
        If Not Page.IsPostBack Then
            Dim t As TextBox = CType(PreviousPage.FindControl("TextBox1"), TextBox)
            Label1.Text = String.Format("Hello {0}", t.Text)
        End If
    End Sub
</script>

<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
    <asp:Label ID="Label1" runat="server" Text="Label"></asp:Label>
</asp:Content>




Any help is GREATLY appreciated. It all worked until I tried it within a page with a master file. Grrr.
  #2 (permalink)  
Old August 5th, 2007, 01:19 PM
Friend of Wrox
 
Join Date: Aug 2006
Location: Bangalore, Karnataka, India.
Posts: 231
Thanks: 0
Thanked 1 Time in 1 Post
Default

i have a similar problem?
Did u solve this

thanks......
  #3 (permalink)  
Old August 6th, 2007, 05:11 AM
Registered User
 
Join Date: Apr 2007
Location: , , .
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to poogles
Default

No, I didn't. I never received a response. I'm guessing I'll have to create that piece of it on a new page without a master file.

Sorry I couldn't help. If you do find a fix, please let me know.

Thanks


Similar Threads
Thread Thread Starter Forum Replies Last Post
Cross-Page Posting roman BOOK: Professional ASP.NET 3.5 : in C# and VB ISBN: 978-0-470-18757-9 1 June 25th, 2008 10:25 AM
Master Pages, Content Pages and CSS carliviris Visual Studio 2005 0 January 8th, 2008 05:56 PM
Master Page File Reference bandrsolutions ASP.NET 2.0 Basics 2 February 7th, 2007 12:26 PM
Master Page/Content Pages coleenh ASP.NET 2.0 Basics 1 September 26th, 2006 02:17 PM
cross-page posting macupryk Visual Studio 2005 0 December 17th, 2004 06:58 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.