Home Search Member List Faq Register Login  
UltimateEditor
Highlight String or put cursor on title of the document file in web editor that are selected from dropdown box.

Thread Starter: sejal   Started: 08-22-2012 6:50 PM   Replies: 0
 Karamasoft Support Forums » General Discussions » UltimateEditor » Highlight String or put cursor on title of the document file in web editor that are selected from dropdown box.
 Printable Version    « Previous Thread   Next Thread »
  22 Aug 2012, 6:50 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
Highlight String or put cursor on title of the document file in web editor that are selected from dropdown box.

 

Hi

 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.

Its similar to following link. In addition I would like to select from dropdown box and depending of selection of section name my cursor should reach on that content/section name in web editor file such as word document or htm document.

https://www.labour.gov.on.ca/english/es/pubs/guide/pregnancy.php#rights

https://www.labour.gov.on.ca/english/es/pubs/guide/pregnancy.php#pregnancy

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 (1 items)
Karamasoft Support Forums » General Discussions » UltimateEditor » Highlight String or put cursor on title of the document file in web editor that are selected from dropdown box.

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.