更新面板不是已知元素
本文关键字:元素 更新 | 更新日期: 2023-09-27 18:31:14
>我在我的aspx文件中收到上述错误"更新面板不是已知元素....."使用 Visual Studio 2013
我认为我的 web.config 文件可能存在问题,它的外观是它的外观
<configuration>
<configSections>
<!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
<section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
</configSections>
<system.web>
<compilation debug="true" targetFramework="4.5" />
<httpRuntime targetFramework="4.5" />
<pages>
<controls>
<add tagPrefix="ajaxToolkit" assembly="AjaxControlToolkit" namespace="AjaxControlToolkit" />
</controls>
</pages></system.web>
<entityFramework>
<defaultConnectionFactory type="System.Data.Entity.Infrastructure.LocalDbConnectionFactory, EntityFramework">
<parameters>
<parameter value="v11.0" />
</parameters>
</defaultConnectionFactory>
<providers>
<provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" />
</providers>
</entityFramework>
我认为这行可能是一个问题:
<section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
有谁知道如何处理这个问题?Ajax 工具包已从 NuGet 安装
ASPX 文件如下我在更新面板上收到错误,说它不是已知元素
<asp:ScriptManager ID="ScriptManager1" runat="server">
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<div id="divContactDetails" class="cssDivContactDetails">
<asp:GridView ID="GridView1" CssClass="cssGridView1" runat="server" DataSourceID="SqlDataSource1" AllowSorting="false" RowStyle-Wrap="true" AutoGenerateColumns="False"
BackColor="#DEBA84" BorderColor="#DEBA84" BorderStyle="None" BorderWidth="1px" CellPadding="3" CellSpacing="2"
DataKeyNames="ContactID" Width="86%" EmptyDataText="There is donation data to be displayed" OnRowDataBound="GridView1_RowDataBound" OnRowEditing="GridView1_RowEditing" >
<Columns>
<asp:CommandField ShowSelectButton="True" />
<asp:BoundField DataField="ContactID" HeaderText="ContactID" SortExpression="ContactID" InsertVisible="False" ReadOnly="True" ></asp:BoundField>
<asp:BoundField DataField="Forename" HeaderText="Forename" SortExpression="Forename" ReadOnly="true"></asp:BoundField>
<asp:BoundField DataField="Surname" HeaderText="Surname" SortExpression="Surname" ReadOnly="true"></asp:BoundField>
<asp:BoundField DataField="AddressLine1" HeaderText="AddressLine1" SortExpression="AddressLine1" ReadOnly="true"></asp:BoundField>
<asp:BoundField DataField="AddressLine2" HeaderText="AddressLine2" SortExpression="AddressLine2" ReadOnly="true"></asp:BoundField>
<%-- <asp:ButtonField Text="Quick Donate" ButtonType="Button" CommandName="InsertQuickDonation" CommandArgument="<%# ((GridViewRow) Container).RowIndex %>">
<ItemStyle CssClass="tableTextContactDetails" />
</asp:ButtonField>--%>
<asp:TemplateField HeaderText="Quick Donate">
<ItemTemplate>
<asp:Button ID="btnQuickDonate" runat="server"
CommandName="Insert"
CommandArgument="<%# ((GridViewRow) Container).RowIndex %>"
OnClick="btnQuickDonate"
Text="Quick Donate" />
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="No Donate">
<EditItemTemplate>
<asp:DropDownList ID="drpNoDonateReasons" runat="server">
<asp:ListItem>Already Paid</asp:ListItem>
<asp:ListItem>Direct Debit</asp:ListItem>
<asp:ListItem>Colletion Missed</asp:ListItem>
<asp:ListItem>Parent not at Home</asp:ListItem>
<asp:ListItem>No Money</asp:ListItem>
</asp:DropDownList>
<asp:Button ID="BtnCancel" runat="server"
CommandName="Cancel"
Text="Cancel"
OnClick="BtnCancel_Click" />
<asp:Button ID="BtnInsert" runat="server"
CommandName="Insert"
CommandArgument="<%# ((GridViewRow) Container).RowIndex %>"
Text="Insert"
OnClick="btnNoDonate" />
</EditItemTemplate>
<ItemTemplate>
<asp:Button ID="btnNoDonate" runat="server"
CommandName="Edit"
CommandArgument="<%# ((GridViewRow) Container).RowIndex %>"
OnClick="btnNoDonation"
Text="No Donate" />
</ItemTemplate>
</asp:TemplateField>
</Columns>
<FooterStyle BackColor="#F7DFB5" ForeColor="#8C4510" />
<HeaderStyle BackColor="#A55129" Font-Bold="True" ForeColor="White" />
<PagerStyle ForeColor="#8C4510" HorizontalAlign="Center" />
<RowStyle BackColor="#FFF7E7" ForeColor="#8C4510" />
<SelectedRowStyle BackColor="#738A9C" Font-Bold="True" ForeColor="White" />
<SortedAscendingCellStyle BackColor="#FFF1D4" />
<SortedAscendingHeaderStyle BackColor="#B95C30" />
<SortedDescendingCellStyle BackColor="#F1E5CE" />
<SortedDescendingHeaderStyle BackColor="#93451F" />
</asp:GridView>
</div>
</asp:UpdatePanel>
</asp:ScriptManager>
Grundy的建议给了我以下运行:
Description: An error occurred during the parsing of a resource required to service this request. Please review the following specific parse error details and modify your source file appropriately.
Parser Error Message: Could not load file or assembly 'Microsoft.AspNet.Web.Optimization.WebForms' or one of its dependencies. The system cannot find the file specified.
Source Error:
[No relevant source lines]
Source File: none Line: 0
Assembly Load Trace: The following information can be helpful to determine why the assembly 'Microsoft.AspNet.Web.Optimization.WebForms' could not be loaded.
=== Pre-bind state information ===
LOG: DisplayName = Microsoft.AspNet.Web.Optimization.WebForms
(Partial)
WRN: Partial binding information was supplied for an assembly:
WRN: Assembly Name: Microsoft.AspNet.Web.Optimization.WebForms | Domain ID: 2
WRN: A partial bind occurs when only part of the assembly display name is provided.
WRN: This might result in the binder loading an incorrect assembly.
WRN: It is recommended to provide a fully specified textual identity for the assembly,
WRN: that consists of the simple name, version, culture, and public key token.
设法安装了Microsoft.AspNet.Web.Optimization.WebForms.dll它在Web表单中创建了一个条目,如下所示:
<add assembly="Microsoft.AspNet.Web.Optimization.WebForms" namespace="Microsoft.AspNet.Web.Optimization.WebForms" tagPrefix="webopt" />
但仍然没有运气,更新面板仍然未知。
同样在做
using system.web.extensions
它似乎没有找到 .extensions,我已经检查了参考,它肯定在那里!
在
UpdatePanel 之前添加脚本管理器
参考: https://forums.asp.net/t/1094344.aspx?The+control+with+ID+UpdatePanel1+requires+a+ScriptManager+on+the+page
感谢Grundy的评论:
解决方案是UpdatePanel
不应该在ScriptManager
内