gpt4 book ai didi

asp.net - HtmlEditorExtender 默认样式

转载 作者:太空宇宙 更新时间:2023-11-04 14:36:39 25 4
gpt4 key购买 nike

我的页面上有一个 ajax HtmlEditorExtender,如下所述:

http://www.asp.net/ajaxLibrary/AjaxControlToolkitSampleSite/HTMLEditorExtender/HTMLEditorExtender.aspx

问题是,它没有任何默认样式。结果,我有一堆没有图像或任何东西的普通按钮。我试着找到这个所谓的“Editor.css”页面,如下所述:http://www.asp.net/ajaxlibrary/act_HTMLEditor.ashx ,但它似乎并不存在于任何地方。它在我的开发服务器上执行此操作,但在我的生产服务器上,它什么也不做(只是一个普通的文本框)。有人可以帮忙吗?

下面是我的aspx代码

<%@ Page Title="" Language="C#" MasterPageFile="~/Site.Master" AutoEventWireup="true" CodeBehind="New.aspx.cs" Inherits="C4G.NPO.Themes.New" %>
<asp:Content ID="Content1" ContentPlaceHolderID="MainContent" runat="server">
<script type="text/javascript">
function colorChanged(sender) {
sender.get_element().style.color = "#" + sender.get_selectedColor();
}
</script>
<script type="text/javascript">
$(document).ready(function () {
$("#Editor").wysiwyg();
});
</script>
<div id="MainContent">
<h1>Add a New Theme</h1>
<div class="Form" style="width: 600px;">
<div class="FormRow">
<asp:Label ID="Label1" runat="server" Text="Name"></asp:Label><asp:TextBox ID="NameTextBox" runat="server"></asp:TextBox>
</div>
<div class="FormRow">
<asp:Label ID="Label2" runat="server" Text="Description"></asp:Label><asp:TextBox ID="DescriptionTextBox" runat="server" TextMode="MultiLine"></asp:TextBox>
</div>
<div class="FormRow">
<asp:TextBox runat="server" ID="Editor"></asp:TextBox>
<ajaxToolkit:HtmlEditorExtender ID="HtmlEditorExtender1"
TargetControlID="Editor" DisplaySourceTab="true"
runat="server">
<Toolbar>
<ajaxToolkit:Undo />
<ajaxToolkit:Redo />
<ajaxToolkit:Bold />
<ajaxToolkit:Italic />
<ajaxToolkit:Underline />
<ajaxToolkit:StrikeThrough />
<ajaxToolkit:Subscript />
<ajaxToolkit:Superscript />
<ajaxToolkit:JustifyLeft />
<ajaxToolkit:JustifyCenter />
<ajaxToolkit:JustifyRight />
<ajaxToolkit:JustifyFull />
<ajaxToolkit:InsertOrderedList />
<ajaxToolkit:InsertUnorderedList />
<ajaxToolkit:CreateLink />
<ajaxToolkit:UnLink />
<ajaxToolkit:RemoveFormat />
<ajaxToolkit:SelectAll />
<ajaxToolkit:UnSelect />
<ajaxToolkit:Delete />
<ajaxToolkit:Cut />
<ajaxToolkit:Copy />
<ajaxToolkit:Paste />
<ajaxToolkit:BackgroundColorSelector />
<ajaxToolkit:ForeColorSelector />
<ajaxToolkit:FontNameSelector />
<ajaxToolkit:FontSizeSelector />
<ajaxToolkit:Indent />
<ajaxToolkit:Outdent />
<ajaxToolkit:InsertHorizontalRule />
<ajaxToolkit:HorizontalSeparator />
<ajaxToolkit:InsertImage />
</Toolbar>
</ajaxToolkit:HtmlEditorExtender>
</div>
<div class="FormRow">

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

为了以防万一,这是我的 web.config 文件:

<?xml version="1.0" encoding="utf-8"?>
<!--
For more information on how to configure your ASP.NET application, please visit
http://go.microsoft.com/fwlink/?LinkId=169433
-->
<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" />
<sectionGroup name="system.web">
<section name="sanitizer" requirePermission="false" type="AjaxControlToolkit.Sanitizer.ProviderSanitizerSection, AjaxControlToolkit"/>
</sectionGroup>
</configSections>
<connectionStrings>
Connection Strings Here
</connectionStrings>
<system.web>
<sanitizer defaultProvider="HtmlAgilityPackSanitizerProvider">
<providers>
<add name="HtmlAgilityPackSanitizerProvider" type="AjaxControlToolkit.Sanitizer.HtmlAgilityPackSanitizerProvider"></add>
</providers>
</sanitizer>
<customErrors mode="Off" />
<compilation debug="true" targetFramework="4.5" />
<httpRuntime targetFramework="4.5" />
<pages>
<namespaces>
<add namespace="System.Web.Optimization" />
<add namespace="Microsoft.AspNet.Identity" />
</namespaces>
<controls>
<add assembly="Microsoft.AspNet.Web.Optimization.WebForms" namespace="Microsoft.AspNet.Web.Optimization.WebForms" tagPrefix="webopt" />
<add tagPrefix="ajaxToolkit" assembly="AjaxControlToolkit" namespace="AjaxControlToolkit" /></controls>
</pages>
<membership>
<providers>
<!--
ASP.NET Membership is disabled in this template. Please visit the following link http://go.microsoft.com/fwlink/?LinkId=301889 to learn about the ASP.NET Membership support in this template
-->
<clear />
</providers>
</membership>
<profile>
<providers>
<!--
ASP.NET Membership Profile is disabled in this template. Please visit the following link http://go.microsoft.com/fwlink/?LinkId=301889 to learn about the ASP.NET Membership support in this template
-->
<clear />
</providers>
</profile>
<roleManager>
<!--
ASP.NET Membership Role is disabled in this template. Please visit the following link http://go.microsoft.com/fwlink/?LinkId=301889 to learn about the ASP.NET Membership support in this template
-->
<providers>
<clear />
</providers>
</roleManager>
<!--
If you are deploying to a cloud environment that has multiple web server instances,
you should change session state mode from "InProc" to "Custom". In addition,
change the connection string named "DefaultConnection" to connect to an instance
of SQL Server (including SQL Azure and SQL Compact) instead of to SQL Server Express.
-->
<sessionState mode="InProc" customProvider="DefaultSessionProvider">
<providers>
<add name="DefaultSessionProvider" type="System.Web.Providers.DefaultSessionStateProvider, System.Web.Providers, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" connectionStringName="DefaultConnection" />
</providers>
</sessionState>
</system.web>
<system.webServer>
<modules runAllManagedModulesForAllRequests="true" />
</system.webServer>
<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>
</configuration>

这是我得到的: enter image description here

最佳答案

您的开发环境或服务器(或两者)是否遇到此问题?

这些图像来自一个名为“WebResource.axd”的文件——您在元素中看不到它,但它是由 AjaxControlToolkit 库自动生成的。在没有看到您的代码或问题示例的情况下,我猜测您的库可能没有在您的元素中正确设置。

设置它的一种简单方法是使用库包管理器 (Nuget) 将库安装到您的网站中。这不仅会设置引用,还会配置您的 web.config。仅供引用,我只是做了以下测试:

1) 在 Visual Studio 中创建一个新的空 ASP.NET 元素2)在元素中添加了一个新的webform3) 从您提供的页面复制示例 HTML 编辑器标记并将其粘贴到我的新表单中4) 在页面中添加了一个 ToolkitScriptManager 和 TextBox,就在表单下方和 HTML 编辑器之前:

<ajaxToolkit:ToolkitScriptManager ID="tsm" runat="server"></ajaxToolkit:ToolkitScriptManager>
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>

5) 将以下属性添加到 HTML 编辑器的标记中(我不建议您这样做 - 我这样做只是为了快速测试):

EnableSanitization="false"

我会自己尝试,如果可行,请比较您的两个元素的不同之处。如果没有,请使用指向您网站的公开链接(如果可能)或您的 HTML 编辑器标记更新此帖子。

关于asp.net - HtmlEditorExtender 默认样式,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18703633/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com