SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    Resident OCD goofball! bronze trophy Serenarules's Avatar
    Join Date
    Dec 2002
    Posts
    1,911
    Mentioned
    26 Post(s)
    Tagged
    0 Thread(s)

    Interesting MasterPage Problem

    Given the three files below, the page that is receiving the post is not exposing the values from the posted form. What might be causing this? In the sample below, all codebehind files remain unchanged from the autogenerated stub.

    I know it's designed to post to itself by default, but there should be a way to change this.

    Code HTML4Strict:
    <%@ Master Language="VB" CodeFile="MasterPage.master.vb" Inherits="MasterPage" EnableViewState = "false" EnableTheming="True" %>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "[url]http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd[/url]">
    <html xmlns="[url]http://www.w3.org/1999/xhtml[/url]">
    <head runat="server">
    <title>Untitled Page</title>
    <asp:ContentPlaceHolder id="head" runat="server">
    </asp:ContentPlaceHolder>
    </head>
    <body>
    <form id="form1" runat="server" action="Default2.aspx">
    <div>
    <asp:ContentPlaceHolder id="ContentPlaceHolder1" runat="server">
     
    </asp:ContentPlaceHolder>
    </div>
    </form>
    </body>
    </html>

    Code HTML4Strict:
    <%@ Page Language="VB" MasterPageFile="~/MasterPage.master" AutoEventWireup="false" CodeFile="Default.aspx.vb" Inherits="_Default" title="Untitled Page" EnableTheming="True" EnableViewState="False" EnableViewStateMac="False" %>
    <asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">
    </asp:Content>
    <asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
    <asp:TextBox ID="SampleData" runat="server" />
    <asp:Button Text="Submit" runat="server" />
    </asp:Content>

    Code HTML4Strict:
    <%@ Page Language="VB" MasterPageFile="~/MasterPage.master" AutoEventWireup="false" CodeFile="Default2.aspx.vb" Inherits="Default2" title="Untitled Page" EnableViewState="False" EnableViewStateMac="False" EnableTheming="True" %>
    <asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">
    </asp:Content>
    <asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
    <%=Request.Form("SampleData")%>
    </asp:Content>

  2. #2
    SitePoint Mentor NightStalker-DNS's Avatar
    Join Date
    Jul 2004
    Location
    Cape Town, South Africa
    Posts
    2,880
    Mentioned
    48 Post(s)
    Tagged
    0 Thread(s)
    Are you posting from default 2 default 2? And how are you doing that?

  3. #3
    Resident OCD goofball! bronze trophy Serenarules's Avatar
    Join Date
    Dec 2002
    Posts
    1,911
    Mentioned
    26 Post(s)
    Tagged
    0 Thread(s)
    I'm sorry, Default.aspx posts to Default2.aspx.

    Of course, because I didn't move the form tag out of the master and into the child, Default2.aspx will also post to itself.

    On further investigation though, it seems it WAS posting, but because the runat="server" form had different elements in it, the values remained unparsed. Doing a form.toString revealed this. Key names were still in $ctl000...blah...blah format.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •