Asked by:
Reg Ajax HTMl editor - unable to set font family & size

Question
-
We are facing an issue in Ajax HTML Editor. The font family and font size are not able to set by default.
For e.g. We require the default font style as "Arial" but displays some other font family.
Please find the sample codes below and suggest.
Thanks in advance.
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %> <%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit.HTMLEditor" TagPrefix="HTMLEditor" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 4.0 Transitional//EN" > <html> <head id="Head1" runat="server"> <title>Sample application</title> <style type="text/css"> .CustomEditorStyle .ajax__htmleditor_editor_toptoolbar { display :none; } .CustomEditorStyle .ajax__htmleditor_editor_bottomtoolbar { display :none; } .CustomEditorStyle .ajax__htmleditor_editor_editpanel { font-family:Arial; font-size: 12px; } </style> </head> <body class="bgcolor" topmargin="0" leftmargin="0"> <form id="form1" runat="server"> <asp:ScriptManager ID="ScriptManager1" runat="server" /> <table id="AutoNumber5" style="border-collapse: collapse; height: 1px; width: 100%;" bordercolor="#111111" cellspacing="0" cellpadding="0" border="0" background="../Images/bg1.jpg"> <tr> <td class="tbllt" width="50%" style="padding-right: 15px; padding-left: 15px; height: 22px" align="left"> <asp:Label ID="Label2" runat="server" Font-Bold="True" CssClass="pglthd">Sample Application</asp:Label> </td> </tr> <tr> <td style="width: 60%; padding-left:30px; padding-right:20px"> <table class="tblrt" cellpadding="0" cellspacing="0" border="0"> <tr> <td class="tblrt" valign="middle" align="left" style="height: 50px;"> <asp:RadioButton ID="rbn_select1" runat="server" AutoPostBack="true" Text="" OnCheckedChanged="rbn_select1_CheckedChanged" /> <asp:TextBox ID="lbl_select1" runat="server" Width="80%" Text="HTML Editor" ReadOnly="True" CssClass="tblrt" Style="font-family:Arial; font-size:12px;" BorderStyle="None"></asp:TextBox> </td> </tr> <tr id="trWebHtmlEditor_reg1" align="center" runat="server"> <td class="tblrt" valign="top" align="left" style="border-style: solid solid solid solid; border-width: 2px; border-color: #7F9DB9; height: 50px; width:500px; "> <HTMLEditor:Editor ID="HtmlEditor_reg1" runat="server" Width="515px" Height="50px" Font-Names="Arial" Font-Size="12px" Font-Bold="False" Font-Italic="False" Font-Overline="False" BorderStyle="None" Enabled="false" BorderWidth="0" Font-Strikeout="False" Font-Underline="False" CssClass ="CustomEditorStyle"/> </td> </tr> <tr> <td class="tblrt" valign="middle" align="left" style="height: 50px;"> <asp:RadioButton ID="rbn_select2" runat="server" AutoPostBack="true" Text="" OnCheckedChanged="rbn_select2_CheckedChanged" /> <asp:TextBox ID="lbl_select2" runat="server" Width="80%" Text="HTML Editor Extender" ReadOnly="True" CssClass="tblrt" Style="font-family:Arial; font-size:12px;" BorderStyle="None"></asp:TextBox> </td> </tr> <tr id="trWebHtmlEditor_reg2" runat="server"> <td class="tblrt" valign="top" align="left" style="border-style: solid solid solid solid; border-width: 2px; border-color: #7F9DB9; height: 60px; width:500px; "> <HTMLEditor:Editor ID="HtmlEditor_reg2" runat="server" Width="515px" Height="60px" Font-Names="Arial" Font-Size="12px" Enabled="false" BorderWidth="0" Font-Strikeout="False" Font-Underline="False" CssClass ="CustomEditorStyle" /> </td> </tr> <tr> <td> </td> </tr> <tr id="trWebHtmlEditor_reg3" runat="server"> <td class="tblrt" valign="top" align="left" style="border-style: solid solid solid solid; border-width: 2px; border-color: #7F9DB9; height: 60px; width:500px; "> <HTMLEditor:Editor ID="HtmlEditor_reg3" runat="server" Width="515px" Height="60px" Font-Names="Arial" Font-Size="12px" Font-Bold="False" Font-Italic="False" Font-Overline="False" BorderStyle="None" Enabled="false" BorderWidth="0" Font-Strikeout="False" Font-Underline="False" CssClass ="CustomEditorStyle" /> </td> </tr> </table> </td> </tr> </table> </form> </body> </html>
using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; public partial class _Default : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { rbn_select1.Checked = false; rbn_select2.Checked = false; HtmlEditor_reg1.Enabled = false; HtmlEditor_reg1.Content = "HTMLEditor is an ASP.NET AJAX Control that allows you to easily create and edit HTML content. Various buttons in toolbar are used for content editing."; HtmlEditor_reg2.Enabled = false; HtmlEditor_reg2.Content = "The HtmlEditorExtender is an ASP.NET AJAX Control that enables you to extend the standard ASP.NET TextBox control with support for rich formatting."; HtmlEditor_reg3.Enabled = false; HtmlEditor_reg3.Content = "We recommend that you use the new HtmlEditorExtender instead of the HtmlEditor control.The HtmlEditorExtender takes advantage of HTML5 and works with IE6 and later."; lbl_select1.ReadOnly = true; lbl_select2.ReadOnly = true; } } protected void rbn_select1_CheckedChanged(object sender, EventArgs e) { HtmlEditor_reg1.Enabled = true; rbn_select2.Checked = false; HtmlEditor_reg2.Enabled = false; HtmlEditor_reg2.BackColor = System.Drawing.Color.White; } protected void rbn_select2_CheckedChanged(object sender, EventArgs e) { HtmlEditor_reg2.Enabled = true; rbn_select1.Checked = false; HtmlEditor_reg1.Enabled = false; } }
Monday, January 27, 2014 9:18 AM