Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie
Hi there,
There is an issue with role permissions that is being worked on at the moment.
If you are having trouble with access or permissions on regional forums please post here to get access: https://www.boards.ie/discussion/2058365403/you-do-not-have-permission-for-that#latest

ASP.NET Query

  • 24-11-2008 7:21pm
    #1
    Closed Accounts Posts: 121 ✭✭


    Hi,
    Ive got a asp.net website with a master page for the layout - a page where a user types in there name and then it is displayed on a different page.

    below is the code i have. im not getting any errors but its not displaying the name when the last page opens

    details page
    <%@ Page Language="VB" MasterPageFile="~/MasterPage.master" AutoEventWireup="false" CodeFile="Details.aspx.vb" Inherits="Details" title="Details" %>
    
    <asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
        <br />
        <asp:TextBox ID="txtFirstName" runat="server" Style="z-index: 100; left: 303px; position: absolute;
            top: 172px"></asp:TextBox>
        <br />
    <asp:Button ID="btnSubmit" PostBackUrl="~/Results.aspx" runat="server" Style="z-index: 109; left: 261px; position: absolute;
            top: 328px" Text="Submit" />
    


    and the results page
    <%@ Page Language="VB" MasterPageFile="~/MasterPage.master" AutoEventWireup="false" CodeFile="Results.aspx.vb" Inherits="Results" title="Results" %>
    <asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
    <asp:Label ID="lblFirstName" runat="server" Style="z-index: 106; left: 181px; position: absolute;
            top: 278px" Text="FirstName"></asp:Label>
    
    </asp:Content>
    

    and the code behind the results page in the results.aspx.vb page
    Partial Class Summary
        Inherits System.Web.UI.Page
    
    
        Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
    
        End Sub
    
    
        Protected Sub lblFirstName_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles lblFirstName.Load
            lblFirstName.Text = Request.Form("Content1$ContentPlaceHolder1$txtFirstName")
        End Sub
    End Class
    

    thanks


Comments

  • Registered Users, Registered Users 2 Posts: 610 ✭✭✭nialo


    Content1$ContentPlaceHolder1$ is not going to be the actual code that is within the webform. when your first page loads. right click it and view the source. find out what Content1$ContentPlaceHolder1$ actually is and replace it with this in your results page.


  • Registered Users, Registered Users 2 Posts: 2,931 ✭✭✭Ginger


    in the results.aspx

    In the Page_Load event try the following

    lblFirstname.Text = Request.Form("txtFirstName")


  • Registered Users, Registered Users 2 Posts: 2,931 ✭✭✭Ginger


    Or

    If Not Page.PreviousPage Is Nothing Then
    Dim SourceTextBox As TextBox
    SourceTextBox = CType(PreviousPage.FindControl("txtFirstName"), _
    TextBox)
    If Not SourceTextBox Is Nothing Then
    lblFirstname.Text = SourceTextBox.Text
    End If
    End If

    Just as a matter of interest why are you doing cross page posting when a simple submit to the original page will work?


  • Closed Accounts Posts: 121 ✭✭Puff Puff Pass


    nialo wrote: »
    Content1$ContentPlaceHolder1$ is not going to be the actual code that is within the webform. when your first page loads. right click it and view the source. find out what Content1$ContentPlaceHolder1$ actually is and replace it with this in your results page.
    thanks nialo, your answer worked.
    in the page load function for the results page i simply used

    lblFirstName.Text = Request.Form("ct100$ContentPlaceHolder1$txtFirstName")

    works perfect,
    thanks


Advertisement