Prevent CTRL V in HTML Editor Ajax Control MS - c#

Hello I am using in C# HTML EDITOR Control MS Ajax.
I would like to know if is possible FORCE the control HTML EDITOR to DO NOT ACCEPT text from PASTE (short cut ctrl+v or menu command).
My aim is to prevent css inline code to be added to the text.
I would allow user to add text if pasted just with HTML EDITOR Button PASTE PLAIN TEXT.
Any ideas?
Do you think it is a good solution or any others= thansk

Trap the keypress event and check for CTRL+V.

Related

Using .NET: How Can I Edit an HTML Form Input Text box?

I want to use .NET to fill a input text box, that's inside an HTML form inside an IE window.
This HTML form is already open inside an Internet Explorer window. So my program doesn't need to open IE, nor does my program need to open an HTML page because, the HTML page is already open.
Can someone point me in the right direction please - how do I edit an input text box inside an IE window?
Thanks for the help guys!
hardcore version
Look at this thread Simulating Key Press c#
I assume you know layout of the form:
write function that will invoke keypress events InvokeKey, take care of tab and space keys as well
Write a function that will convert string to series of keypress events let's say WriteItForMe(string input) using function in 1.
To fill form do this (example)
WriteItForMe("Michael");
InvokeKey("#tab");
WriteItForMe("Scofield");
InvokeKey("#tab");
etc.

How to show a hyperlink in a text

I have a text which may contain some special characters like <b></b> or a link. I want the user to be able to click on the link and open it. TextBlock or RichTextBox seems doesn't show links in a proper way:
<RichTextBox >
<Paragraph>
click here: http://www.google.com
</Paragraph>
</RichTextBox>
How can I show a text like that in a page?
Update: seems my question isn't clear. I ask a server for content and it returns back to me something like this:
from <b><i><a href="http://www.google.com" rel=nofollow> lorem ipsom
NPR:

 tapped in front of you probably know Bill Gates...
I want to show this in a WINDOWS PHONE page. TextBlock doesn't render it well. how can I show it human readable?
The way to solve your problem I see in using of WebBrowser control.
Then, accordingly to the article, you should go with Javascript to manage the links clicking etc (unless you want the links would be opened automatically with standard logic of Windows Phone):
Script is disabled in the WebBrowser control by default. Set the
IsScriptEnabled property to true if you want to enable scripting in
your control. You can then call scripts using the InvokeScript method.
The ScriptNotify event occurs when JavaScript in the WebBrowser
control passes a string to managed code.
That's a bit tricky way, but if you want to go any other way, you would have to implement your own parser of the code and build the sentence with labels and custom hyperlinks (as in provided above suggestions from comments).

how to validate tinymce through jquery in asp.net

I have many ascx control files in which I am using the tinymce editor and I am calling all ascx file in one master page on different different btn click.
Now I want, when I click on button A, and I have typed something into the tinymce editor and suddenly I click on button B then the page which is opened on btn click A must ask whether you need to save this text or not on btn click B.
How can I do it with the help of jquery? If there is some other way then please let me know.
I would like you to refer to my answer here....
Using the jQuery Validate plugin with the TinyMCE editor
It will solve your issue of validating the editor client side before sending it to server.
When the user starts editing the content in tinymce editor set a flag isContentChanged to true. Add an event handler to the Button B. In the event handler, you can check for the isContentChanged flag and show an alert that the user is losing unsaved information, if the flag is true. You can use basic JS or Jquery to do this.

ASP.NET Which HTML editor can do everything I want?

I have tried to use the standard AJAX HTMLeditor from here (http://www.asp.net/ajaxlibrary/act.ashx) and I have try to work with the FCKEditor (from http://ckeditor.com/)
But both don't do everything. I call the AJAX standard control A and the FCKeditor F.
With the A editor it is impossible to get your HTML text in the HTML content. You can only get it in the Design content. (this next code doesn't do the job: string htmlContentStr = Editor1.Content).
With F it is possible to get it in the HTML content (it does this by default), but to get your changes back in HTML is impossible. (this next code doesn't do the job: string htmlContentStr = FCKeditor1.Value).
So what I need is a HTML editor that is possible to put HTML text in HTML content, a user can make changes in the designcontent and after the changes 're make it must be possible to get the HTMLcontent and put it away in a string or database.
Is this possible or do I need a commercial one to get this feature?
If my question isn't clear, please let me know.
Thnx
I've used XStandard quite easily and it let me manipulate the HTML. I didn't bother using it as a control, but just read and wrote (escaped) the HTML where needed into the asp output.

Text inside a text box that must be cleared when clicked

I am using ASP.NET.
I am not sure what you will call this but I would like text to be displayed in my text box called txtName. So when the form load the text box will have faded text that will say "Required". Then when the user click inside the text box i want the user to place a value inside the text box.
Is this possible in ASP.NET? If so, how can this be done????
If you can use the MS AjaxControlToolkit, there is a watermark extender that will do precisely that.
MS Ajax TextBoxWatermark Extender
If not, you can probably find a jQuery plugin or roll your own javascript. Using server-side events will probably not do what you want.
onClick is a client side event. onFocus may be better. You can use
txtName.Attributes.Add("onFocus", "this.value = '';this.style.color = 'black';")
Put it in the Page's PreRender event.
Here's a great jQuery plug-in:
http://www.mudaimemo.com/p/formnotifier/
Try something like this:
<asp:TextBox ID="txtName" runat="server"
onclick="if (this.value == 'Required') {this.value=''}"
Width="275px">Required</asp:TextBox>
If using the Ajax Toolkit is an option or makes sense there is a tool in the tool box called textbox watermark (see http://www.asp.net/AJAX/AjaxControlToolkit/Samples/TextBoxWatermark/TextBoxWatermark.aspx)

Categories