Telerik Forums
UI for ASP.NET AJAX Forum
1 answer
247 views

I am using the RadEditor component. I am storing the content in a database text field with a max length of 4000 characters. I used a telerik javascript solution to limit the number of characters in the content to 4000 characters. This does not work because the database field needs to store not only the characters in the design or preview tab of the component but the HTML characters as well.

Anyway, I get the HTML from the editor.get_HTML(true), if I use the LENGTH (editor.get_HTML(True).Length). I get the number of characters that is previewed or in the design tab. I need the TOTAL number of characters in the HTML string including the HTML code such as <br />, <span>, etc.

editor.get_HTML(True).Length does not work is can not use a BLOB or CLOB.

Here is the javascript code.

 

<

 

script type="text/javascript">

 

 

 

 

 

var editorList= new Object();

 

 

var editorLengthArray = [4000,4000];

 

 

var counter = 0;

 

 

function isAlphaNumericKey(keyCode)

 

{

 

if ((keyCode > 47 && keyCode < 58) || (keyCode > 64 && keyCode < 91))

 

{

 

return true;

 

}

 

return false;

 

}

 

 

function LimitCharacters(editor)

 

{

editorList[editor.get_id()] = editorLengthArray[counter];

counter++;

 

editor.attachEventHandler(

"onkeydown", function(e)

 

{

e = (e ==

null)? window.event : e;

 

 

if (isAlphaNumericKey(e.keyCode))

 

{

 

var maxTextLength = editorList[editor.get_id()];

 

 

textLength = editor.get_html().length;

 

if (textLength >= maxTextLength)

 

{

alert(

'You are not able to type more than ' + maxTextLength + ' symbols!');

 

e.returnValue =

false;

 

}

}

});

 

 

var element = document.all ? editor.get_document().body : editor.get_document();

 

$telerik.addExternalHandler(element,

"paste", function(e)

 

{

e = (e ==

null)? window.event : e;

 

 

 

var maxTextLength = editorList[editor.get_id()];

//this code below does not work for me. it returns the number of characters previewed
//not the total number of characters in the HTML string/

 

textLength = editor.get_html(true).length;<<<<<<<<<<<<<

 

 

var clipboardLength = window.clipboardData.getData("Text").length;

 

textLength += clipboardLength;

 

if (textLength >= maxTextLength)

 

{

alert(

'You reached the 4000 symbol limit for your content.');

 

e.returnValue =

false;

 

 

return false;

 

 

}

});

}

 

 

function CalculateLength(editor, value)

 

{

 

var textLength = editor.get_html(true).length;

 

 

var clipboardLength = value.length;

 

 

textLength += clipboardLength;

 

return textLength;

 

}

 

 

function OnClientPasteHtml(editor, args)

 

{

 

var maxTextLength = editorList[editor.get_id()];

 

 

var commandName = args.get_commandName();

 

 

var value = args.get_value();

 

 

 

if (commandName == "PasteFromWord"

 

|| commandName ==

"PasteFromWordNoFontsNoSizes"

 

|| commandName ==

"PastePlainText"

 

|| commandName ==

"PasteAsHtml"

 

|| commandName ==

"Paste" )

 

{

 

var textLength = CalculateLength (editor, value);

 

alert(

'TL='+textLength);

 

 

if (textLength >= maxTextLength)

 

{

alert(

'You reached the 4000 symbol limit for your content.');

 

args.set_cancel(

true);

 

}

}

}

 

function OnClientSubmit(editor)

 

{

 

var textLength = editor.get_html().length;

 

 

if (textLength > 4000)

 

{

alert(

'You reached the 4000 symbol limit. Your content will be truncated!');

 

}

}

 

</

 

script>

 

Rumen
Telerik team
 answered on 21 Dec 2009
2 answers
80 views
hi please refere the attached.
i have edit and delete image in the grid, if i delete the record should delete. if i click edit the contents should populated in the above three fields and there i can edit. after i click update the contents should go back to the grid.
any idea on how to do this?

<

 

telerik:GridTemplateColumn HeaderStyle-VerticalAlign="Middle" UniqueName="TypeOfLead"

 

 

HeaderText="Action" ItemStyle-HorizontalAlign="Center" HeaderStyle-Width="40">

 

 

<ItemTemplate>

 

 

<asp:Image runat="server" ID="imgManualType" ImageUrl="../Images/icons/icon_edit.gif"

 

 

Visible="true" />

 

 

<asp:Image runat="server" ID="Image1" ImageUrl="../Images/icons/icon_delete.gif"

 

 

Visible="true" />

 

 

</ItemTemplate>

 

 

</telerik:GridTemplateColumn>

 



Pavlina
Telerik team
 answered on 21 Dec 2009
1 answer
93 views
Hi,

I have been implementing RAD GRID Pagination as it was working for me with Multiview RAD Control and Tab Strips, but since I tried it to make compatible with Jquery Tab Search, it's not working anymore.

If I click on "2" i.e. Page 2 or so... the grid goes blank and then I need to click on search button "which eventually populates the grid. I have checked for the view state, viewstate doesn't seems to be an issue.

What could be the possible cause?
Thanks
Pavlina
Telerik team
 answered on 21 Dec 2009
2 answers
124 views
Hi :
 
                    <telerik:GridGroupByExpression> 
                        <SelectFields> 
                            <telerik:GridGroupByField FieldAlias="StartDate" FieldName="Start" FormatString="{0:d}"></telerik:GridGroupByField> 
                        </SelectFields> 
                        <GroupByFields> 
                            <telerik:GridGroupByField FieldName="Start" SortOrder="Ascending" FormatString="{0:d}"></telerik:GridGroupByField> 
                        </GroupByFields> 
                    </telerik:GridGroupByExpression> 
In the source-code above, a field named Start is added into the GridField and the grouping field title will be something like
StartDate:2009-10-1. However, it is possible to remove the StartDate and just show 2009-10-1.
Does anyone have idea for it?
Princy
Top achievements
Rank 2
 answered on 21 Dec 2009
1 answer
106 views

Hello,

Does your newest release support scatter charts (with or without lines)?

Thanks.

Steve
Bartholomeo Rocca
Top achievements
Rank 1
 answered on 21 Dec 2009
9 answers
231 views
Hi,

I use RadWindow as a login screen which works almost perfectly. The problem is, Opera (9.62) places the window on top of the screen - the topmost part of the window is outside the screen.
Since I'm not sure if this is a RadWindow or Opera issue I created a new project with only a RadWindow in it. The behavior is the same.

How can I fix this?
Best regards,
Robert
Martin
Telerik team
 answered on 21 Dec 2009
4 answers
187 views




Nikolay Rusev
Telerik team
 answered on 21 Dec 2009
3 answers
172 views
Hi, at moment I am using 404 handler to redirect the page, since I can not use server.transfer anymore because of the ajax framework, I am hitting by the URL problem now (SEO, ability to read and etc).

As I am aware of the redirecting method, and I am aware the sitefinitiy actually has a proper URLRewrite module incorporated
http://www.telerik.com/help/aspnet-ajax/ajxredirectingtoanotherpage.html

Would you suggest me any URLRewrite module that works well with telerik control?

Thanks
Georgi
Telerik team
 answered on 21 Dec 2009
1 answer
129 views
I was watching one of the client side databinding videos on Telerik TV and it said to search for and download the DynamicLinq.cs file to incorporate into your project.

I can't find it - anyone know where I can get it?

--Kdc

Here's the link to the RadTip
http://tv.telerik.com/radtips/radgrid/radgrid-for-asp.net-ajax-+-declarative-client+side-databinding,-part-2
Radoslav
Telerik team
 answered on 21 Dec 2009
2 answers
85 views
Hi
I got a serious problem with the RadGrid under Mono: I cannot get paging to work. My configuration is indeed very simple. I just have a grid with a SqlDataSource on my page. On MS.NET everything works fine, but with Mono I just get the first page (not even all data).
I tried to bind the grid to lists as well with the same result.
I am using RadControls Q2/2009 (Update is not possible because my project does not run under Mono with a newer version at all) and Mono 2.4.3.2.

Can anybody give me a hint what to do?

Best regards
Ferdinand
Ferdinand
Top achievements
Rank 1
 answered on 21 Dec 2009
Narrow your results
Selected tags
Tags
+? more
Top users last month
Tien
Top achievements
Rank 1
Iron
Krasimir
Top achievements
Rank 3
Bronze
Iron
Iron
Cedar
Top achievements
Rank 1
Iron
Emil
Top achievements
Rank 1
Iron
Kyle Watson
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Tien
Top achievements
Rank 1
Iron
Krasimir
Top achievements
Rank 3
Bronze
Iron
Iron
Cedar
Top achievements
Rank 1
Iron
Emil
Top achievements
Rank 1
Iron
Kyle Watson
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?