Xheditor1.1.14 as an online editor for uploading local images in ASP. NET Web site development

Source: Internet
Author: User

Xheditor is a multi-platform lightweight visual XHTML editor based on jquery development, powerful and easy to use, the editor is used on the CSDN website's published article page. Here is a way to use the editor when developing a Web page in a vs2013 environment and to implement a local image upload.

1. Search and download the file xheditor1.1.1 package online, after decompression should be a including jquery, Xheditor_emo, T xheditor_plugins, Xheditor_skin, A folder such as demos folders and Xheditor-1.1.14-zh-cn.min.js files.

2. Start vs2013, execute "file-new-site", in the "New Web Site" window, select "Visual C #", ". NET Framework 4", "ASP." NET Empty website "," File System "," D:\WebSite1 ".

3. Copy and paste all four folders, such as jquery, Xheditor_emo, T Xheditor_plugins, Xheditor_skin, as described in the first step, into the "D:\WebSite1" folder described in the second.

Then copy and paste the "Xheditor-1.1.14-zh-cn.min.js" in the file pressure described in the first step into the "D:\WebSite1" folder described in the second.

4. Copy and paste the two files upload.aspx, saveremoteimg.aspx in the Demos folder described in the first step into the "D:\WebSite1" folder described in the second.

5. Create a new folder named "Upload" within the "D:\WebSite1" folder.

6. Go back to vs2013, add a Web form for the website, called "Default.aspx", and edit the file as follows:

<%@ page language= "C #" autoeventwireup= "true" validaterequest= "false"Codefile= "Default.aspx.cs" inherits= "_default"%>
<! DOCTYPE html>
<meta http-equiv= "Content-type" content= "text/html; Charset=utf-8 "/>
<title></title>
<script type= "Text/javascript" src= ". /jquery/jquery-1.4.4.min.js "></script>
<script type= "Text/javascript" src= ". /xheditor-1.1.14-zh-cn.min.js "></script>
<body>
<form id= "Form1" runat= "Server" >
<div>
<asp:textbox id= "TextBox1" runat= "Server" height= "300px" textmode= "MultiLine" width= "948px"
Cssclass= "Xheditor {tools: ' Cut,copy,paste,pastetext,fontface,fontsize,blocktag,bold,italic,underline, Strikethrough,fontcolor,backcolor,removeformat,align,list,outdent,indent,link,unlink,img,emot,table,about ', Skin: ' Default ', Showblocktag:false, Internalscript:false, Internalstyle:false, width:948, height:300, LoadCSS: ' http ://xheditor.com/test.css ', Fullscreen:false, Sourcemode:false, Forceptag:true, Upimgurl: ' upload.aspx ', UpImgExt: ' Jpg,jpeg,gif,png '} ' >

</asp:TextBox>
<br/>
<asp:button id= "Button1" runat= "Server" text= "button" onclick= "Button1_Click"/>
<br/>
<asp:label id= "Label1" runat= "Server" text= "Label" ></asp:Label>
</div>
</form>
</body>

Be careful to understand the bold part.

7. Edit the Default.aspx.cs file as follows:

public partial class _default:system.web.ui.page
{
protected void Page_Load (object sender, EventArgs e)
{
}
protected void Button1_Click (object sender, EventArgs e)
{
Label1.Text = TextBox1.Text;
}

}

Note the bold section.

8. Edit the Web,config file as follows:

<?xml version= "1.0" encoding= "Utf-8"?>
<configuration>
<system.web>
<compilation debug= "True" targetframework= "4.0"/>

</system.web>
</configuration>

Note the bold section.

9. You are done, run Default.aspx, a beautiful editor appears on the webpage, using the picture function, can upload the local or the Internet slice to the server. Press button to pass the edited content to Label1.

Xheditor1.1.14 as an online editor for uploading local images in ASP. NET Web site development

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.