Install cuteeditor5.0 and use it with ajax.net to perform database operations without refreshing!

Source: Internet
Author: User
Cuteeditor is really a good web online editor, but the installation of 5.0 is a bit different from the previous version, the cracked version of 5.0 is: http://www.seaskyer.net, after downloading decompress it, everyone on Earth knows this.
Create a web site in vs2005. add cuteeditor to the tool panel. right-click the tool panel and select Choose item. In the displayed dialog box, select browser and find cuteeditor. DLL.
Let's add another edit. asxp: drag the editor in the tool panel to the page. at this time, the authorization file cuteeditor. LIC should also be automatically stored in the bin directory. If it does not exist, we must manually bake it in. at this time, if we compile it directly, the system will prompt an error. Because 5.0 has added an editorimage function, we must put cuteeditor. imageeditor. DLL and netspell. spellchecker. DLL (because the spelling check is enabled by default) is baked to the bin directory of the project, at the same time, we also need to copy all the extracted cutesoft_client directories to the root directory of the application. at this time, there should be no errors during compilation. If there is another Windows integrated identity verification error, we need to modify the configuration in IIS, there is a directory security in the properties of this site in IIS. Then click "authentication" and "Access Control" to edit it, and mark the front mark of Integrated windows identity authentication.
The above is just the simplest installation, as well as the control of the display of cueeditor, the security and what to upload, And the directory to control user uploads, you can also create an image directory for each user. now we will start using Ajax. net to insert the content of cuteeditor into the database.
For more information about how to install Ajax. net, see my other scam article: Ajax. Net quick start.
How can I insert content in cueeditor into the database using Ajax? The key is to obtain the Client ID of cuteeditor, which can be obtained through <% = editor1.clietid %>. and how to obtain the content in the editor on the client. this can use his internal javascript API, gethtml (), note that it is HTML. the following is an HTML button code that inserts the content of cuteeditor into the database:
<Input id = "btnok" type = "button" value = "OK" onclick = "inserteditor ();"/>
Next is a JS Script: Let's assume that the editor ID is editor1.
<Script language = "JavaScript" type = "text/JavaScript">
<! --
Function inserteditor ()
{
VaR editor = Document. getelementbyid ('<% = editor1.clientid %> ');
VaR editortext = editor. gethtml ();
Wddhy. editmypage. inserteditor (editortext, oncomplete );
}
Function oncomplete (RET)
{
If (Ret. value = "OK ")
{
Alert ("saved successfully! ");
}
Else
{
Alert ("failed! ");
}
}
// -->
</SCRIPT>
Let's look at the Ajax method of the server segment:
[Ajaxpro. ajaxmethod]
Public String inserteditor (string insertstr)
{
String connstr = system. configuration. configurationmanager. receivettings ["connstring"]. tostring ();
Sqlconnection conn = new sqlconnection (connstr );
String comment STR = "insert into usercontent (this_content, this_name) values (@ content, @ name )";
Sqlcommand comm = new sqlcommand (reverse STR, Conn );
// In 2005, assign a simple Dora to the parameter !!
Comm. Parameters. addwithvalue ("@ content", insertstr );
Comm. Parameters. addwithvalue ("@ name", "pwqzc ");
Conn. open ();
Try
{
Comm. executenonquery ();
Return "OK ";
}
Catch
{
Return "bad ";
}
Finally
{
Conn. Close ();
}
Run. Let's write something to cuteeditor. click the button to insert the data !!!
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.