本文介绍了Ajax HtmlEditorExtender接受空白的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

HI,

我正在应用程序中的Description字段中使用Ajax HtmlEditorExtender.

我的示例代码:



I am using an Ajax HtmlEditorExtender for Description field in my application.

My Sample Code:

<asp:TextBox ID="txtDescription" TextMode="MultiLine" Height="100" CssClass="text" runat="server" />
<ajax:HtmlEditorExtender ID="HtmlEditorExtender2" TargetControlID="txtDescription" runat="server">
       <Toolbar>
            <ajax:Bold />
            <ajax:Italic />
            <ajax:Underline />
            <ajax:HorizontalSeparator />

             <ajax:JustifyLeft />
             <ajax:JustifyCenter />
             <ajax:JustifyRight />
             <ajax:JustifyFull />
             <ajax:HorizontalSeparator />

             <ajax:InsertUnorderedList />
             <ajax:ForeColorSelector />

        </Toolbar>
 </ajax:HtmlEditorExtender>



当我尝试使用空格键并输入密钥时,此说明文本框接受空白. 描述"字段是必填字段,因此不应接受空格.

我无法使用FilteredTextBoxExtender/RequiredFieldValidator/Javascript验证来验证此控件(txtDescription).



This description textbox is accepting empty spaces when i tried with space bar and enter key. The Description field is mandatory and so it should not accept empty spaces.

I am unable to validate this control(txtDescription) using FilteredTextBoxExtender/RequiredFieldValidator/Javascript validation.

Help me out pls!!

推荐答案

function CheckBlankSpace(txtBoxId) 
{
     var tb = document.getElementById(txtBoxId);

     // Trim white space if any before taking value length
     var tbLen = tb.value.trim().length;
     if (tbLen == 0)
     {
        // Raise error or do whatever you like
     }
}



根据需要对其进行修改.



Modify it as per your need.


这篇关于Ajax HtmlEditorExtender接受空白的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-28 13:58