***100分***求FCKeditor的用法

wackyan 2004-04-29 03:14:16
各种属性的用法,与数据库的连接,保存数据。。等等
有源码最好,谢谢!
...全文
87 11 点赞 打赏 收藏 举报
写回复
11 条回复
切换为时间正序
当前发帖距今超过3年,不再开放新的回复
发表回复
wackyan 2004-05-08
谁给发的,来领分,谢谢
  • 打赏
  • 举报
回复
gj0001 2004-04-30
接后台代码:
using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
using DAL;
using Model;
using System.Web.Security ;

namespace document.admin
{
/// <summary>
/// editfile 的摘要说明。
/// </summary>
public class editfile : System.Web.UI.Page
{
protected System.Web.UI.WebControls.TextBox TextBox_title;
protected System.Web.UI.WebControls.DropDownList DropDownList_typeid;
protected System.Web.UI.WebControls.TextBox TextBox_writer;
protected System.Web.UI.WebControls.TextBox TextBox_writefrom;
protected System.Web.UI.WebControls.TextBox TextBox_publish_date;
protected System.Web.UI.WebControls.CheckBox CheckBox_templateid;
protected System.Web.UI.WebControls.TextBox TextBox_review;
protected FredCK.FCKeditor editor_content;
protected System.Web.UI.WebControls.Button Button_save;
protected System.Web.UI.WebControls.Label Label_templateid;
protected System.Web.UI.WebControls.RequiredFieldValidator RequiredFieldValidator1;
protected System.Web.UI.WebControls.RequiredFieldValidator RequiredFieldValidator3;
protected System.Web.UI.WebControls.RequiredFieldValidator RequiredFieldValidator2;
protected System.Web.UI.WebControls.Panel Panel1;


private void Page_Load(object sender, System.EventArgs e)
{
// 在此处放置用户代码以初始化页面

if (Request.QueryString["fileid"]==null)
{
ViewState["fileid"]=0;
}
else
{
ViewState["fileid"]=Request.QueryString["fileid"];
}

int fileid=Convert.ToInt32(ViewState["fileid"]);


if (!User.Identity.IsAuthenticated )
{
Response.Write("<script>alert('你无权修改本页面!');</script>");
//Response.Redirect("../login.aspx");
return;

}



int userid=Convert.ToInt32(User.Identity.Name);

if (new DRight().UserFileRight(fileid,userid)=="no")
{
Response.Write("<script>alert('你无权修改本页面!');</script>");
//Response.Redirect("../login.aspx");
return;

}


if (new DRight().UserFileRight(fileid,userid)=="add")
{
ViewState["file"]="add";
if (!Page.IsPostBack)
bindBlank(userid);
}

if (new DRight().UserFileRight(fileid,userid)=="edit")
{
ViewState["file"]="edit";
if (!Page.IsPostBack)
bindForm(fileid,userid);
}





}

public void bindForm(int fileid,int userid)
{
bindType(userid);
FileInfo myfile=new FileInfo();
myfile=new DFile().GetFileInfo(fileid);

TextBox_title.Text =myfile.Title ;
DropDownList_typeid.SelectedIndex =new DType().GetTypeIndex(myfile.Typeid,userid);
TextBox_writer.Text=myfile.Writer ;
TextBox_writefrom.Text=myfile.Writefrom ;
TextBox_publish_date.Text =myfile.Publish_date.ToShortDateString();

if (myfile.Templateid !=0)
{
CheckBox_templateid.Checked =true;
}
else
{
CheckBox_templateid.Checked =true;
}

TextBox_review.Text =myfile.Review;
editor_content.Value =myfile.Content ;
}



public void bindBlank(int userid)
{
bindType(userid);
TextBox_publish_date.Text=DateTime.Now.ToShortDateString();
TextBox_title.Text ="";
TextBox_writer.Text="";
TextBox_writefrom.Text ="";
CheckBox_templateid.Checked =false;
TextBox_review.Text ="";
editor_content.Value ="";

}



public void bindType(int userid){
DropDownList_typeid.DataSource =new DType().GetTypeRightDv(userid);
DropDownList_typeid.DataTextField ="name";
DropDownList_typeid.DataValueField ="typeid";
DropDownList_typeid.DataBind();
}


#region Web Form Designer generated code
override protected void OnInit(EventArgs e)
{
//
// CODEGEN:该调用是 ASP.NET Web 窗体设计器所必需的。
//
InitializeComponent();
base.OnInit(e);
}

/// <summary>
/// 设计器支持所需的方法 - 不要使用代码编辑器修改
/// 此方法的内容。
/// </summary>
private void InitializeComponent()
{
this.CheckBox_templateid.CheckedChanged += new System.EventHandler(this.CheckBox_templateid_CheckedChanged);
this.Button_save.Click += new System.EventHandler(this.Button_save_Click);
this.Load += new System.EventHandler(this.Page_Load);

}
#endregion

private void Button_save_Click(object sender, System.EventArgs e)
{
if (ViewState["file"].ToString()=="add") //新增记录
{
FileInfo myfile=new FileInfo();
myfile.Fileid =0;
myfile.Typeid =Convert.ToInt32( DropDownList_typeid.SelectedItem.Value );
myfile.Title =TextBox_title.Text ;
myfile.Writer =TextBox_writer.Text ;
myfile.Writefrom =TextBox_writefrom.Text ;
myfile.Userid =Convert.ToInt32(User.Identity.Name);
myfile.Content =editor_content.Value.ToString();
myfile.Publish_date =Convert.ToDateTime(TextBox_publish_date.Text);
myfile.Read_time =0;
myfile.Templateid =Convert.ToInt32(Label_templateid.Text) ;
myfile.Review =TextBox_review.Text ;
myfile.IP =Request.UserHostAddress;
if (new DFile().Insert(myfile)==true)
{
Response.Write("<script>alert('文档已成功保存!');</script>");
bindBlank(Convert.ToInt32(User.Identity.Name));
}
else
{
Response.Write("<script>alert('文档保存失败,请检查!');</script>");

}
}

if (ViewState["file"].ToString()=="edit") //更改记录
{
FileInfo myfile=new FileInfo();
myfile.Fileid =Convert.ToInt32(ViewState["fileid"]);
myfile.Typeid =Convert.ToInt32( DropDownList_typeid.SelectedItem.Value );
myfile.Title =TextBox_title.Text ;
myfile.Writer =TextBox_writer.Text ;
myfile.Writefrom =TextBox_writefrom.Text ;
myfile.Userid =new DFile().GetFileInfo(Convert.ToInt32(ViewState["fileid"])).Userid ;
myfile.Content =editor_content.Value.ToString();
myfile.Publish_date =Convert.ToDateTime(TextBox_publish_date.Text);
myfile.Read_time =new DFile().GetFileInfo(Convert.ToInt32(ViewState["fileid"])).Read_time ;
myfile.Templateid =Convert.ToInt32(Label_templateid.Text) ;
myfile.Review =TextBox_review.Text ;
myfile.IP =new DFile().GetFileInfo(Convert.ToInt32(ViewState["fileid"])).IP ;

if (new DFile().Update(myfile)==true)
{
Response.Write("<script>alert('文档已更新成功!');</script>");
bindBlank(Convert.ToInt32(User.Identity.Name));
}
else
{
Response.Write("<script>alert('文档保存失败,请检查!');</script>");

}
}
Response.Clear();
Response.End();


}

private void CheckBox_templateid_CheckedChanged(object sender, System.EventArgs e)
{
if (CheckBox_templateid.Checked==true )
{
int typeid=Convert.ToInt32( DropDownList_typeid.SelectedItem.Value ) ;
int templateid=new DType().GetTypeTemplateid(typeid);
if (templateid!=0)
{
editor_content.Value=new DTemplate().GetTemplateInfo(templateid).content ;
Label_templateid.Text =templateid.ToString();

}
else
{
editor_content.Value="" ;
Label_templateid.Text ="0";
}
}
else
{
editor_content.Value="" ;
Label_templateid.Text ="0";

}

}



}
}
  • 打赏
  • 举报
回复
gj0001 2004-04-30
我写的文档管理系统中的一部分,Fckeditor简单好用
<%@ Page language="c#" Codebehind="editfile.aspx.cs" AutoEventWireup="false" Inherits="document.admin.editfile" %>
<%@ Register TagPrefix="cc1" Namespace="FredCK" Assembly="FredCK.FCKeditor" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
<HTML>
<HEAD>
<title>文件编辑窗口</title>
<meta content="Microsoft Visual Studio 7.0" name="GENERATOR">
<meta content="C#" name="CODE_LANGUAGE">
<meta content="JavaScript" name="vs_defaultClientScript">
<meta content="http://schemas.microsoft.com/intellisense/ie5" name="vs_targetSchema">
<LINK href="../site.css" type="text/css" rel="stylesheet">
</HEAD>
<body MS_POSITIONING="GridLayout">
<form id="editfile" method="post" runat="server">
<FONT face="宋体">
<asp:Panel id="Panel1" style="Z-INDEX: 101; LEFT: 8px; POSITION: absolute; TOP: 8px" runat="server" Width="100%" Height="500px">
<TABLE id="Table1" borderColor="#000000" cellSpacing="1" borderColorDark="#dcdcdc" cellPadding="0" width="100%" align="center" bgColor="gainsboro" borderColorLight="#ffffff" border="1">
<TR>
<TD colSpan="2"><FONT face="宋体">文档标题:
<asp:textbox id="TextBox_title" runat="server" Width="80%"></asp:textbox>
<asp:RequiredFieldValidator id="RequiredFieldValidator1" runat="server" ErrorMessage="*" ControlToValidate="TextBox_title"></asp:RequiredFieldValidator></FONT><FONT face="宋体"></FONT></TD>
</TR>
<TR>
<TD width="50%"><FONT face="宋体">所属类别:
<asp:dropdownlist id="DropDownList_typeid" runat="server" Width="70%"></asp:dropdownlist>
<asp:RequiredFieldValidator id="RequiredFieldValidator3" runat="server" ErrorMessage="*" ControlToValidate="DropDownList_typeid"></asp:RequiredFieldValidator></FONT></TD>
<TD width="50%"><FONT face="宋体">原文作者:
<asp:textbox id="TextBox_writer" runat="server" Width="70%"></asp:textbox>
<asp:RequiredFieldValidator id="RequiredFieldValidator2" runat="server" ErrorMessage="*" ControlToValidate="TextBox_writer"></asp:RequiredFieldValidator></FONT></TD>
</TR>
<TR>
<TD><FONT face="宋体">  原出处:
<asp:textbox id="TextBox_writefrom" runat="server" Width="80%"></asp:textbox></FONT></TD>
<TD><FONT face="宋体">发布日期:
<asp:TextBox id="TextBox_publish_date" runat="server" Width="70%"></asp:TextBox></FONT></TD>
</TR>
<TR>
<TD><FONT face="宋体">导入模板:
<asp:CheckBox id="CheckBox_templateid" runat="server" AutoPostBack="True"></asp:CheckBox> </FONT></TD>
<TD><FONT face="宋体">  关键字:
<asp:TextBox id="TextBox_review" runat="server" Width="80%"></asp:TextBox></FONT></TD>
</TR>
<TR>
<TD colSpan="2">
<cc1:FCKeditor id="editor_content" runat="server" Height="260px" Width="100%" BasePath="../FCKeditor/"></cc1:FCKeditor></TD>
</TR>
<TR>
<TD align="middle" colSpan="2"><FONT face="宋体">
<asp:Button id="Button_save" runat="server" Text="保 存"></asp:Button></FONT></TD>
</TR>
</TABLE>
<asp:Label id="Label_templateid" runat="server" Visible="False">0</asp:Label>
</asp:Panel></FONT>
</form>
</body>
</HTML>
  • 打赏
  • 举报
回复
vzxq 2004-04-30
FCKeditor 是什么啊?学习!
  • 打赏
  • 举报
回复
nameldw 2004-04-30
没用过,学习
  • 打赏
  • 举报
回复
wackyan 2004-04-30
谢谢楼上的
各种属性的用法有具体点的吗?
希望晚上可以揭贴
  • 打赏
  • 举报
回复
tnt8csdn2000 2004-04-29
UP
  • 打赏
  • 举报
回复
wackyan 2004-04-29
顶一下~~
  • 打赏
  • 举报
回复
liuyu202 2004-04-29
没用过!

关注一下!
  • 打赏
  • 举报
回复
wackyan 2004-04-29
没人用过吗,?帮忙顶,谢谢啊
  • 打赏
  • 举报
回复
tnt8csdn2000 2004-04-29
这个东东真是强大,就是不会用。
UP一下
  • 打赏
  • 举报
回复
相关推荐
发帖
.NET社区
加入

5.9w+

社区成员

.NET技术交流专区
申请成为版主
帖子事件
创建了帖子
2004-04-29 03:14
社区公告
暂无公告