?
Solved

Rich Text Editor Control

Posted on 2005-04-11
9
Medium Priority
?
389 Views
Last Modified: 2008-02-01
I have developed an ASP.NET Rich Text Editor control, which works nicely (minus one key feature).  The issue is I am having trouble with, is getting the data from the RTE to the code behind page where it can be used, written to a file, etc.

Basically, I want to be able to use the RTE like I would an asp:textbox, as in placing the control on a page, and having access to it, programatically through code behind pages.

I see only one way to do this, is to have a hidden input field embedded with the control.  Once the form is submitted, the value of the RTE will be written to  the hidden field, which I can then access via a Request or HtmlControl.

The tricky part is that this has to be done before the form posts back, via a javacript.  I can do this manually by adding an "onsubmit" event to the form of the page, but I want this control to be self sufficient.

How can I programatically, attach an "onsubmit" call to a form of an aspx page?
0
Comment
Question by:mmarksbury
  • 3
  • 3
  • 2
  • +1
9 Comments
 
LVL 9

Expert Comment

by:Type25
ID: 13759954
Can add it manually in the aspx page, ie:

<form id=frm onsubmit="filHiddenField()">


<script>
fillHiddenField()
{
   document.getElementById('hidden1Content').text =  document.getElementById('yourEdiableDiv').innerHTML;
}
</script>
0
 
LVL 23

Accepted Solution

by:
Jens Fiederer earned 2000 total points
ID: 13761642
For Internet Explorer, attachEvent will do the job.

var myElement=document.getElementById('hiddenElement');

myElement.form.attachEvent('onsubmit', YourHandlerFunction);

However, this is not portable to other browsers.

For a more portable solution, you can use the Page.RegisterOnSubmitStatement method on the server side while loading your control.
0
 
LVL 26

Expert Comment

by:Rejojohny
ID: 13762891
r u using the richtextbox provided to be used as a server control .. u will get the latest download from their site .. reference the dll in ur project .. then register it in ur aspx page
<%@ Register TagPrefix="RTB" Namespace="RichTextBoxControl" Assembly="RichTextBox"%>
then use this tag
<RTB:RICHTEXTBOX id="RichtextBox1" runat="server" Width="93%" BorderStyle="None" BorderWidth="2px"
                                          HtmlOptionIsEnabled="False" ToolbarAutoHideIsEnabled="False" ToolbarLayout="fontmenu,fontsizemenu,fontforecolormenu,fontbackcolormenu,bold,italic,underline:superscript,subscript,strikethrough,separator,leftjustify,centerjustify,rightjustify,separator,numberedlist,bullets,outdent,indent,separator,cut,copy,paste,separator,undo,redo,separator,print,insertdate,inserttime"
                                          EditorBorderStyle="Inset"></RTB:RICHTEXTBOX>

and in the code beind it is accessble as a normal server control ...
like to access the text u can use RichtextBox1.Text

I have used this and it works fine ..
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 7

Author Comment

by:mmarksbury
ID: 13762915
Rejojhny, that is the goal with my control, and I am almost there.  For reference however, what is the site you are talking about?
0
 
LVL 26

Expert Comment

by:Rejojohny
ID: 13763063
have a look here
http://www.asp.net/ControlGallery/ControlDetail.aspx?Control=174&tabindex=0
http://www.richercomponents.com/richtextbox/

i think u should find lots of these controls if u search the net ..
0
 
LVL 7

Author Comment

by:mmarksbury
ID: 13763122
Thanks.  I'm not looking to PURCHASE an RTE control.  

I will try the  "Page.RegisterOnSubmitStatement" and any other suggestions this evening, and award the winner at that time.

QUESTION STILL OPEN
0
 
LVL 9

Expert Comment

by:Type25
ID: 13769944
You could try  www.freetextbox.com   which is pretty awesome. (and FREE)
0
 
LVL 26

Expert Comment

by:Rejojohny
ID: 13770971
i thought u already had the richtextbox control ..
0
 
LVL 7

Author Comment

by:mmarksbury
ID: 13778790
Thanks, that's exactly what I was asking for, a way to attach an onsubit method to my form programatically from the Server Side.  Thanks
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article discusses the ASP.NET AJAX ModalPopupExtender control. In this article we will show how to use the ModalPopupExtender control, how to display/show/call the ASP.NET AJAX ModalPopupExtender control from javascript, how to show/display/cal…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
Screencast - Getting to Know the Pipeline
As many of you are aware about Scanpst.exe utility which is owned by Microsoft itself to repair inaccessible or damaged PST files, but the question is do you really think Scanpst.exe is capable to repair all sorts of PST related corruption issues?
Suggested Courses

850 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question