Home Search Member List Faq Register Login  
UltimateAjax
Re: updating UltimateEditor using a DropDownList, Please help me....

Thread Starter: jackw8   Started: 12-16-2008 6:47 AM   Replies: 7
 Karamasoft Support Forums » General Discussions » UltimateAjax » Re: updating UltimateEditor using a DropDownList, Please help me....
 Printable Version    « Previous Thread   Next Thread »
  16 Dec 2008, 6:47 AM
jackw8 is not online. Last active: 12/19/2008 7:14:50 AM jackw8

Not Ranked
Joined on 12-16-2008
Boston, Ma
Posts 3
updating UltimateEditor using a DropDownList
I'm trying to update EditorHTML when a user selects an option from a dropdownlist but I am getting an error. 
Oddly enough, the IE error is "uab0 is null or not an object" and my Firefox error is "uad2 has no properties".
I looked at the sample here http://www.karamasoft.com/Samples.aspx?component=UltimateAjax&sample=AjaxEditor but it too has an "unspecified error". here is my callback event:

Protected Sub UltimateAjax1_Callback(ByVal sender As Object, ByVal e As Karamasoft.WebControls.UltimateAjax.CallbackEventArgs) Handles UltimateAjax1.CallbackMe.kueLttr.EditorHtml = ""Dim ltr As String = Me.ddlLttr.SelectedItem.Value, strLttr As String = "", strErr As String = ""calls.readLttr(ltr, strLttr, strErr)If strErr <> "" Then   Me.lblUpdate.Text = strErr   ReturnEnd IfstrLttr = strLttr.Replace(AM, "")Me.kueLttr.EditorHtml = strLttrEnd Sub
 

here is my BLOCKED SCRIPT

<script language="javascript" type="text/javascript">function UpdateEditor(param) {   DoUltimateCallback('UltimateAjax1', param);}</script>
 

Most of this was taken right from your examles.

  
  16 Dec 2008, 10:02 AM
Karamasoft is not online. Last active: 5/8/2018 10:36:45 AM Karamasoft

Top 10 Posts
Joined on 09-05-2004
Posts 6,820
Re: updating UltimateEditor using a DropDownList
We tested our live demo in both IE7 and Firefox 3.0.3 but didn't get an "unspecified error". Which web browser have you used to test? If you send us a sample web app having this issue, we can try it in our test environment.
  
  18 Dec 2008, 9:14 AM
jackw8 is not online. Last active: 12/19/2008 7:14:50 AM jackw8

Not Ranked
Joined on 12-16-2008
Boston, Ma
Posts 3
Re: updating UltimateEditor using a DropDownList
I too am using IE7 (7.0.5730.13) and I'm using Firefox 2 (2.0.0.18).  Firefox doesn't actually throw the error, IE7 does, Firefox just doesn't populate EditorHTML.  If you click on the "Content" dropdown list and choose anything other than Document 1 you will get the error.  It's an IE error that appears in the status bar.
Here is a (non) working example;
Page Source:

<%@ Page Language="VB" AutoEventWireup="true" CodeFile="Default.aspx.vb" Inherits="_Default" %>

<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %>

<%@ Register Assembly="UltimateAjax" Namespace="Karamasoft.WebControls.UltimateAjax"

TagPrefix="kswc" %>

<%@ Register Assembly="UltimateEditor" Namespace="Karamasoft.WebControls.UltimateEditor"

TagPrefix="kswc" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">

<head runat="server">

<title>Untitled Page</title>

<script language="javascript" type="text/javascript">

function UpdateEditor(param) {

DoUltimateCallback('UltimateAjax1', param);

}

</script>

</head>

<body>

<form id="form1" runat="server">

<asp:ScriptManager ID="ScriptManager1" runat="server" />

<div>

<cc1:TabContainer ID="TabContainer1" runat="server" ActiveTabIndex="0">

<cc1:TabPanel ID="TabPanel1" runat="server" HeaderText="TabPanel1">

<ContentTemplate>

<kswc:UltimateAjax ID="UltimateAjax1" runat="server" Height="150px" Width="200px">

<asp:DropDownList ID="DropDownList1" runat="server">

<asp:ListItem>Document 1</asp:ListItem>

<asp:ListItem>Document 2</asp:ListItem>

<asp:ListItem>Document 3</asp:ListItem>

</asp:DropDownList>

<kswc:UltimateEditor ID="UltimateEditor1" runat="server">

</kswc:UltimateEditor>

</kswc:UltimateAjax>

</ContentTemplate>

</cc1:TabPanel>

<cc1:TabPanel ID="TabPanel2" runat="server" HeaderText="TabPanel2">

</cc1:TabPanel>

</cc1:TabContainer></div>

</form>

</body>

</html>


VB

Partial Class _Default

Inherits System.Web.UI.Page

<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()

End Sub

Private Sub Page_Init(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Init

'CODEGEN: This method call is required by the Web Form Designer

'Do not modify it using the code editor.

InitializeComponent()

End Sub

Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load

Me.DropDownList1.Attributes.Add("onchange", "UpdateEditor('content');")

Me.UltimateEditor1.EditorHtml = "This is Document 1"

End Sub

Protected Sub UltimateAjax1_Callback(ByVal sender As Object, ByVal e As Karamasoft.WebControls.UltimateAjax.CallbackEventArgs) Handles UltimateAjax1.Callback

Select Case Me.DropDownList1.SelectedIndex

Case Is = 0

Me.UltimateEditor1.EditorHtml = "This is Document 1"

Case Is = 1

Me.UltimateEditor1.EditorHtml = "This is Document 2"

Case Is = 2

Me.UltimateEditor1.EditorHtml = "This is Document 3"

End Select

End Sub

End Class
 



  
  18 Dec 2008, 3:05 PM
Karamasoft is not online. Last active: 5/8/2018 10:36:45 AM Karamasoft

Top 10 Posts
Joined on 09-05-2004
Posts 6,820
Re: updating UltimateEditor using a DropDownList
You need to update your UpdateEditor client-side method as follows:

function UpdateEditor(param) {
DoUltimateCallback('TabContainer1_TabPanel1_UltimateAjax1', param);
}

  
  19 Dec 2008, 7:14 AM
jackw8 is not online. Last active: 12/19/2008 7:14:50 AM jackw8

Not Ranked
Joined on 12-16-2008
Boston, Ma
Posts 3
Re: updating UltimateEditor using a DropDownList
Works like a charm.  Thanks very much.
  
  18 Aug 2012, 5:51 AM
sejal is not online. Last active: 8/22/2012 7:00:31 PM sejal

Top 10 Posts
Joined on 08-18-2012
Posts 6
Re: updating UltimateEditor using a DropDownList

Hi

 

I have question that I need to change section in same document depending on dropdownlist box. how I can do it?

As for example, I have loaded one document in web editor that have four section, named section1, section2, section3, and section4, each section has some details. and I put one dropdownlist box that have item name section1, section2, section3, and section4.

now I want to navigate/put  my cursor in webeditor file (its single file/document) depending on dropdownlistbox section/item.

 

Please help me.


  
  19 Aug 2012, 12:15 PM
Karamasoft is not online. Last active: 5/8/2018 10:36:45 AM Karamasoft

Top 10 Posts
Joined on 09-05-2004
Posts 6,820
Re: updating UltimateEditor using a DropDownList
There is no built-in functionality to place the cursor to an anchor element. However, you can use the client-side API methods such as GetCurrentRange to retrieve the current range and programmatically find your anchor elements to move the cursor to. Please refer to the documentation at http://www.karamasoft.com/UltimateEditor/ClientAPI.htm.
  
  22 Aug 2012, 6:40 PM
sejal is not online. Last active: 8/22/2012 7:00:31 PM sejal

Top 10 Posts
Joined on 08-18-2012
Posts 6
Re: updating UltimateEditor using a DropDownList, Please help me....

 

Here is my .ASPX file

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Copy of EditorContent1.aspx.cs" Inherits="EditorContent1" %>

<%@ Register TagPrefix="kswc" Namespace="Karamasoft.WebControls.UltimateEditor" Assembly="UltimateEditor" %>

<!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 id="Head2" runat="server">

<title>Editor Content (File)</title>

<link href="../../../KaramasoftStyles.css" type="text/css" rel="stylesheet" />

<script type="text/javascript">

function displayHome()

// { document.getElementById("theWashingtonPost").style.display = "block"; }

{

alert("Hello! I am an alert box!");

// var str = "Visit W3Schools!";

// var n = str.search("W3Schools");

var msg="Section4";

addmessage(msg);

}

function addmessage(msg) {

UltimateEditors['<%=UltimateEditor2.ClientID%>'].StoreCurrentRange();

// UltimateEditors['<%=UltimateEditor2.ClientID%>'].SetFocus().search(msg);

UltimateEditors['<%=UltimateEditor2.ClientID%>'].InsertHTML(msg);

}

 

</script>

</head>

<body>

<form id="form1" runat="server">

<div>

<br />

<asp:DropDownList ID="DropDownList1" runat="server" AutoPostBack="True"

onselectedindexchanged="DropDownList1_SelectedIndexChanged"

>

<%-- onunload="addmessage(msg)"--%>

<asp:ListItem>Section1</asp:ListItem>

<asp:ListItem>Section2</asp:ListItem>

<asp:ListItem>Section3</asp:ListItem>

<asp:ListItem>Section4</asp:ListItem>

<asp:ListItem></asp:ListItem>

</asp:DropDownList>

&nbsp;<asp:TextBox ID="TextBox1" runat="server" ontextchanged="TextBox1_TextChanged" ></asp:TextBox>

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;

<asp:TextBox ID="TextBox2" runat="server"></asp:TextBox>

<br />

<br />

<table class="PageText" border="0" cellpadding="0" cellspacing="0">

<%--<tr text="Sectip">

<td>

&nbsp;<br/>

</td>

</tr>--%>

<tr>

<td><kswc:ultimateeditor id="UltimateEditor2" runat="server"

EditorSource="~/UltimateEditorInclude/UltimateEditorFull.xml"

OnPostBack="UltimateEditor1_PostBack" Width="575px" Height="263px"></kswc:ultimateeditor></td>

</tr>

<tr>

<td>

<br/>

</td>

</tr>

</table>

</div>

</form>

</body>

</html>

 

 

and here is my .CS file

 

using System;

using System.Data;

using System.Configuration;

using System.Collections;

using System.Collections.Generic;

using System.Linq;

using System.Web;

using System.Web.Security;

using System.Web.UI;

using System.Web.UI.WebControls;

using System.Web.UI.WebControls.WebParts;

using System.Web.UI.HtmlControls;

using System.IO;

using System.ComponentModel;

using System.Drawing;

using System.Web.SessionState;

 

public partial class EditorContent1 : System.Web.UI.Page

{

protected void Page_Load(object sender, EventArgs e)

{

if (!Page.IsPostBack)

{

string editorFile = Page.MapPath("EditorContent1.htm");

LoadEditorFile(editorFile);

}

}

// Load file and set editor content

private void LoadEditorFile(string editorFile)

{

StreamReader sr = File.OpenText(editorFile);

UltimateEditor2.EditorHtml = sr.ReadToEnd();

// UltimateEditor2.EditorHtml.

sr.Close();

}

// Save file with the editor content

private void SaveEditorFile(string editorFile)

{

StreamWriter sw = File.CreateText(editorFile);

sw.Write(UltimateEditor2.EditorHtml);

sw.Close();

}

 

protected void UltimateEditor1_PostBack(object sender, Karamasoft.WebControls.UltimateEditor.PostBackEventArgs e)

{

if (e.PostBackValue == "Save")

{

string editorFile = Page.MapPath("EditorContent1.htm");

SaveEditorFile(editorFile);

}

}

 

protected void DropDownList1_SelectedIndexChanged(object sender, EventArgs e)

{

string select= DropDownList1.SelectedItem.Text;

if (UltimateEditor2.EditorHtml.Contains(select))

{

//UltimateEditor2.EditorHtml.StartsWith("section4");

//UltimateEditor2.EditorHtml.Replace(select, "section31");

TextBox1.Text = select;

UltimateEditor2.SetFocus = true;

UltimateEditor2.GetEditorText();

}

else

{ TextBox2.Text = "not found it";}

TextBox1.Text = select;

UltimateEditor2.SetFocus = true;

string txt= UltimateEditor2.GetEditorText();

TextBox2.Text = txt;

DropDownList1.Attributes.Add("onclick", displayHome();");

// hell();

 

}

protected void TextBox1_TextChanged(object sender, EventArgs e)

{

//TextBox1.Attributes.Add("onclick", displayHome();");

}

protected void DropDownList1_Unload(object sender, EventArgs e)

{

}

}

 

 

 

 

 

 

 


  
 Page 1 of 1 (8 items)
Karamasoft Support Forums » General Discussions » UltimateAjax » Re: updating UltimateEditor using a DropDownList, Please help me....

You can add attachments
You can post new topics
You can reply to topics
You can delete your posts
You can edit your posts
You can create polls
You can vote in polls
Forum statistics are enabled
Forum is unmoderated

© 2002-2018 Karamasoft LLC. All rights reserved.