日期:2014-05-17  浏览次数:20439 次

为什么要提交两次
用验证控件来验证FCKEditor不为空时,为什么要提交两次。当进行第一次提交时,验证控件提示内容不能为空。再进行第二次提交则不提示了,此时FCKEditor是非空的。

代码如下:
<FCKeditorV2:FCKeditor ID="Cont_Notice" runat="server" Height="400">
</FCKeditorV2:FCKeditor>
<asp:RequiredFieldValidator ID="RequiredFieldValidator3" runat="server"
ErrorMessage="请输入信息内容!" ControlToValidate="Cont_Notice"
Display="None"></asp:RequiredFieldValidator>

在页面的开始处是:

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Admin_Notice.aspx.cs" MasterPageFile="~/Admin/Admin.Master" Inherits="NanTunCoalMine.Admin.Admin_Notice" ValidateRequest="false" %>

<%@ Register assembly="FredCK.FCKeditorV2" namespace="FredCK.FCKeditorV2" tagprefix="FCKeditorV2" %>
是不是“ValidateRequest="false" ”的原因?还是验证控件不能验证FCKEditor?如果不能怎么处理比较好?




------解决方案--------------------
自定义空验证
if(FCKeditorAPI.GetInstance("txtDecription").GetXHTML(true)=="")
{FCKeditorAPI.GetInstance("").Focus();}
txtDecription.Value.Length>0

http://dotnet.chinaitlab.com/ASPNET/799882.html
------解决方案--------------------
字段验证控件是验证不到fck的,要自定义验证

探讨
自定义空验证
if(FCKeditorAPI.GetInstance("txtDecription").GetXHTML(true)=="")
{FCKeditorAPI.GetInstance("").Focus();}
txtDecription.Value.Length>0

http://dotnet.chinaitlab.com/ASPNET/799882.html

------解决方案--------------------
不能通过验证控件判断fck是否为空的问题,fck和验证控件是有冲突的 其实根本不建议你用验证控件做验证,应该用js做,如果是前台界面的话,验证控件消耗资源太大。
------解决方案--------------------
用JS做,方便点。
------解决方案--------------------
验证控件内部也是用js做的 所以一般的验证尽量直接使用js包括jquey类库