ASP.NET与主控 [英] ASP.NET with Master PAges

查看:78
本文介绍了ASP.NET与主控的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用母版页,并且有2个用户控件.子页面出现问题,这些用户控件未显示,出现以下错误

I''m using Master Pages, and there are 2 user control. Problem arises with child page, those user controls are not displayed, it gives following error

Error Rendering Control - urctheader
Error Rendering Control - urctlAliaFormsLeftMenu



以下是我的主控页和子页的代码段

母版页:



Following is snippet of my code both Master and Child Page

Master Page:

<pre lang="xml"><%@ Master Language="VB" AutoEventWireup="false" CodeBehind="Main.master.vb" Inherits="AliaForms.Main" %>
<%@ Register TagPrefix="uc1" TagName="AliaFormsLeftMenu" Src="~/Controls/AliaFormsLeftMenu.ascx" %>
<%@ Register TagPrefix="uc1" TagName="AliaFormsTopPanel" Src="~/Controls/TopPanel.ascx" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title></title>
   <script src="/js/ValidateInput.js" type="text/javascript"></script>
</head>
<body>
    <form id="form1" runat="server">
    <div id="mainwrapper">
   <uc1:AliaFormsTopPanel id="urctheader" runat="server"  ></uc1:AliaFormsTopPanel>
                <uc1:AliaFormsLeftMenu id="urctlAliaFormsLeftMenu" runat="server"></uc1:AliaFormsLeftMenu>
                <div id="content_wrapper">
        <asp:ContentPlaceHolder ID="cphMain" runat="server">
        </asp:ContentPlaceHolder>
        </div>
    </div>
    </form>
</body>
</html>





子页面:





Child Page:

<pre lang="xml"><%@ Page Language="vb" AutoEventWireup="false" CodeBehind="PreEstimate.aspx.vb" Inherits="AliaForms.PreEstimate" MasterPageFile="~/Main.Master" Theme="Alia" StylesheetTheme="Alia" Title="Estimates" %>
<%@ Register Assembly="EuoControl" Namespace="EuoControl" TagPrefix="acc"  %>
<asp:Content ID="cphCl" ContentPlaceHolderID="cphMain" runat="server"


>


>

<h2>Estimate</h2>
<div id="table_border">
<div class="row tar">
<div class="fr" style="padding-left:10px"> <span class="btn"><a href="PreEstimateAdd.aspx?EstId=-1" runat="server" id="btnAdd"><img src="../images/btn_create.jpg" border="0" title="Add" /></a></span></div>
<div class="fr" style="padding-left:10px" > <asp:ImageButton runat="server" ID="btnExcel" ImageUrl="~/Images/btn_Excel.jpg" /></div>
<div class="fr" style="padding-left:10px"  > <asp:ImageButton runat="server" ID="btnCatalogue"  ImageUrl="~/Images/btn_Catalogue.jpg"  /></div>
</div>
<asp:UpdatePanel runat="server" ID="upSearch" UpdateMode="Conditional" RenderMode="Inline">
<ContentTemplate>
<div>
<div class="fl">Client :<br/><asp:dropdownlist id="dropdownlistClient" CssClass="dropdown" runat="server" Width="160px" AutoPostBack="True" ></asp:dropdownlist></div>
<div class="fl"  style="padding-left:5px">
Brand :<br/><asp:dropdownlist id="dropdownlistbrands" runat="server" Width="160px" AutoPostBack="True" ></asp:dropdownlist></div>
<div class="fl"  style="padding-left:5px">
BilledTo :<br/><asp:dropdownlist id="dropdownlistbilledto" runat="server"

        Width="160px" AutoPostBack="False" Height="16px" ></asp:dropdownlist>
</div>
<div class="fl" style="padding-left:5px" > <asp:ImageButton runat="server" ID="btnSearch"

        ImageUrl="~/App_Themes/Alia/Images/btn_search.jpg"  /></div>
<div  class="fl" style="padding-left:5px" > <asp:ImageButton runat="server" ID="btnReferesh"

        ImageUrl="~/Images/btn_Refresh.jpg"  /></div>
</div>
</ContentTemplate>
</asp:UpdatePanel>


<asp:Label id="labelMsg" class="red_txt" runat="server" EnableViewState="False"></asp:Label>

<DIV id="table">
<asp:UpdatePanel runat="server" ID="upGrid" UpdateMode="Conditional" >
<ContentTemplate>
<acc:GridEuo ID="gvEstimate" SkinID="ProductView" runat="server" DataKeyNames="EstimateId"

                            DataSourceID="odsEstimates"

        AutoGenerateColumns="False"  >
                            <Columns>
                            <asp:TemplateField  >
                            <HeaderTemplate>
                                <asp:CheckBox runat="server" ID="HeaderLevelCheckBox" onclick="javascript:SelectAllCheckboxes(this);" AutoPostBack="false" ToolTip="Select/Deselect All"  />
                                </HeaderTemplate>
                            <ItemTemplate>
                            <asp:CheckBox  runat="server" ID="checkboxselect" />
                               <asp:Label ID="lblEstimateId" runat="server" Visible="false"   Text='<%# DataBinder.Eval(Container.DataItem,"EstimateId")%>' ></asp:Label>
                            </ItemTemplate>
                            </asp:TemplateField>
                                <asp:BoundField DataField="Estimatenumber" HeaderText="Estimate No." SortExpression="Estimatenumber" />
                                <asp:BoundField DataField="EstimateDate" HeaderText="EstimateDate" HtmlEncode="False"

                                    DataFormatString="{0:dd/MM/yyyy}" SortExpression="EstimateDate" />
                                    <asp:BoundField DataField="EstimateJobList" HeaderText="Job No" SortExpression="EstimateJobList" />
                                <asp:BoundField DataField="clientname" HeaderText="Client" SortExpression="clientname" />
                                <asp:BoundField DataField="brand" HeaderText="Brand" SortExpression="brandname" />
                                <asp:BoundField DataField="billedto" HeaderText="Billed To" SortExpression="billedto" />

                                <asp:BoundField DataField="GrandTotal" HeaderText="Grand Total" HtmlEncode="False" DataFormatString="{0:n2}" SortExpression="GrandTotal" />
                                <asp:BoundField DataField="Remark" HeaderText="Remark" SortExpression="Remark" />
                                <asp:BoundField DataField="EstApprovalStatus" HeaderText="Approval Status" SortExpression="EstApprovalStatus" />

                                <asp:TemplateField Visible="false">
                                    <ItemTemplate>
                                        <asp:ImageButton AlternateText="Delete" ImageUrl="~/App_Themes/Alia/Images/Delete.gif" runat="server" CausesValidation="false"

                                            CommandName="DeleteRc" CommandArgument='<%# Eval("EstimateId") %>' ID="cmdDelete"

                                            OnClientClick="if (confirm('Are you sure you want to delete this Estimate?') == false) return false;" />
                                    </ItemTemplate>
                                </asp:TemplateField>
                                <asp:TemplateField>
                                    <ItemTemplate>
                                    <a runat="server" ID="HypApprove"  Visible="true" href="#"   >Set Approval</a>
                                    </ItemTemplate>
                                    </asp:TemplateField>
                                  <asp:TemplateField>
                                    <ItemTemplate>
                                    <asp:LinkButton runat="server" ID="linkSave" Text="Save"  CommandName="linkSave" CommandArgument='<%# Eval("EstimateId") %>' ></asp:LinkButton><br/>
                                    <asp:HyperLink runat="server" ID="HypSend" Text="ReSend Estimate" Target="_self" Visible="false" NavigateUrl='<%# "~/Pages/PreEstimateAdd.aspx?EstId=" & Eval("EstimateId") %>' ></asp:HyperLink>
                                    </ItemTemplate>
                                    </asp:TemplateField>
                            </Columns>
                            <EmptyDataTemplate>
                                No Estimates.
                            </EmptyDataTemplate>
                            <EmptyDataRowStyle BackColor="White" Height="30px" />
                        </acc:GridEuo>
                        <asp:HiddenField ID="hdSearchCrt" runat="server" />
                        <asp:ObjectDataSource ID="odsEstimates" runat="server" SelectCountMethod="GetViewCount"

                            EnablePaging="true" SelectMethod="GetView"  SortParameterName="sortExpression"

                            TypeName="AliaForms.AliaManager.clsEstimateBL">
                            <SelectParameters>
                                <asp:ControlParameter ControlID="hdSearchCrt" Name="Criteria" PropertyName="Value"

                                    Type="String" DefaultValue="" />
                            </SelectParameters>
                        </asp:ObjectDataSource>
</ContentTemplate>
<Triggers >
<asp:PostBackTrigger ControlID="gvEstimate" />
</Triggers>
</asp:UpdatePanel>

</DIV>
</div>
</asp:Content>





推荐答案

Please include <scriptmanager> in your child page.
Please include <scriptmanager> in your child page.
<asp:content id="cphCl" contentplaceholderid="cphMain" runat="server" xmlns:asp="#unknown">
<asp:scriptmanager id="ScriptManager1" runat="server"></scriptmanager>

<asp:UpdatePanel runat="server" ID="upGrid" UpdateMode="Conditional" RenderMode="Block" >



If the RenderMode property is set to Inline, the content of an UpdatePanel control is rendered inside an HTML <span> element. If the RenderMode property is set to Block, it is rendered inside an HTML <div>元素.

If this helped you then please Vote and marked it as answer.



If the RenderMode property is set to Inline, the content of an UpdatePanel control is rendered inside an HTML <span> element. If the RenderMode property is set to Block, it is rendered inside an HTML <div> element.

If this helped you then please Vote and marked it as answer.


这篇关于ASP.NET与主控的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆