Click here to Skip to main content
15,067,335 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have a dynamic data website. I have an insert page for the parent record after I click the insert button on the parent page I want it to redirect to the child insert page. All this works fine. When I get to the insert form for the child and view source I get garbled information then below that it has the option value and it list every record in the table. The vb and markup is generated by the dynamic website. I only changed setting the primary key fields for the child record from the querystring passed from the parent. Any help would be appreciated.

When I press the insert key for the child record I get:

Maximum request length exceeded. 
  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.Web.HttpException: Maximum request length exceeded.

Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Stack Trace:

[HttpException (0x80004005): Maximum request length exceeded.]
   System.Web.HttpRequest.GetEntireRawContent() +9693899
   System.Web.HttpRequest.FillInFormCollection() +420
   System.Web.HttpRequest.EnsureForm() +75
   System.Web.HttpRequest.get_Form() +12
   System.Web.HttpRequest.get_HasForm() +9695295
   System.Web.UI.Page.GetCollectionBasedOnMethod(Boolean dontReturnNull) +95
   System.Web.UI.Page.DeterminePostBackMode() +69
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +130

The vb code for my child insert is below.

Imports System.Web.DynamicData
Imports System.Web.Routing
Imports System.Web.UI.WebControls.Expressions

Class Insert
    Inherits Page

    Protected table As MetaTable
    Protected Sub Page_Init(ByVal sender As Object, ByVal e As EventArgs)
        table = DynamicDataRouteHandler.GetRequestMetaTable(Context)
        FormView1.SetMetaTable(table, table.GetColumnValuesFromRoute(Context))
        DetailsDataSource.EntityTypeFilter = table.EntityType.Name

        Dim tbl_lat_video_inspect_detail = New tbl_Lat_video_inspect_detail()
        'Set primary keys
        tbl_lat_video_inspect_detail.Permit = Request.QueryString("pstr")
        tbl_lat_video_inspect_detail.DateofVideoInsp = Request.QueryString("dv")

        FormView1.SetMetaTable(FormView1.GetMetaTable(), tbl_lat_video_inspect_detail)
    End Sub
    Protected Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs)
        Title = table.DisplayName
    End Sub
    Protected Sub FormView1_ItemCommand(ByVal sender As Object, ByVal e As FormViewCommandEventArgs)
        If e.CommandName = DataControlCommands.CancelCommandName Then
        End If
    End Sub
    Protected Sub FormView1_ItemInserted(ByVal sender As Object, ByVal e As FormViewInsertedEventArgs)
        If e.Exception Is Nothing OrElse e.ExceptionHandled Then
        End If
    End Sub
End Class

The mark up for the child form is as follows:

<%@ Page Language="VB" MasterPageFile="~/Site.master" CodeFile="Insert.aspx.vb" Inherits="Insert" %>

<asp:Content ID="headContent" ContentPlaceHolderID="head" Runat="Server">

<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
    <asp:DynamicDataManager ID="DynamicDataManager1" runat="server" AutoLoadForeignKeys="true">
            <asp:DataControlReference ControlID="FormView1" />

    <h2 class="DDSubHeader">Add new entry to table <%= table.DisplayName %></h2>

    <asp:UpdatePanel ID="UpdatePanel1" runat="server">
            <asp:ValidationSummary ID="ValidationSummary1" runat="server" EnableClientScript="true"
                HeaderText="List of validation errors" CssClass="DDValidator" />
            <asp:DynamicValidator runat="server" ID="DetailsViewValidator" ControlToValidate="FormView1" Display="None" CssClass="DDValidator" />

            <asp:FormView runat="server" ID="FormView1" DataSourceID="DetailsDataSource" DefaultMode="Insert"
                OnItemCommand="FormView1_ItemCommand" OnItemInserted="FormView1_ItemInserted" RenderOuterTable="false">
                    <table id="detailsTable" class="DDDetailsTable" cellpadding="6">
                        <asp:DynamicEntity runat="server" Mode="Insert" />
                        <tr class="td">
                            <td colspan="2">
                                <asp:LinkButton runat="server" CommandName="Insert" Text="Insert"  />
                                <asp:LinkButton runat="server" CommandName="Cancel" Text="Cancel" CausesValidation="false" />

            <asp:EntityDataSource ID="DetailsDataSource" runat="server" EnableInsert="true" />
Updated 24-Aug-15 6:16am
ZurdoDev 24-Aug-15 15:46pm
You posted a lot of stuff here and it's hard to follow. Basically, the id of the parent is not getting passed through when saving the child, right? If so, just track that down.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900