Hi, I urgently need help, please.
WebtextEdit ClientSideEvent execute javascript statement on mousemove event. I can successfully change the style of another object type on this WebTextEdit ClientSide MouseMove event:document.getElementById("Object2").style.backgroundColor = '#F0F5F7';
But when I want to change the style of the WebTextEdit control:document.getElementById("WebTextEdit1").style.backgroundColor = '#F0F5F7'; Then nothing happens
When I execute the script on the same WebTextEdit Clientside for another object which is not a WebtextEdit:Object2.style.border='1px solid #FFE6A0'; Then it works
But when I want to change the WebtextEdit Clientside style:WebTextEdit1.style.border='1px solid #FFE6A0';
Then I get Error: Can't Eval WebTextEdit1.style.border='1px solid #FFE6A0';
Please Help
Hi David,
I think your codes will have same exception without user control. To process client events the ClientSideEvents property should be used, but not attributes or similar explicit handlers. It is ok to register handler using Page.ClientScript.RegisterClientScriptBlock if you need dynamic content.
webTextEditor1.ClientSideEvents.KeyDown = "keyPressInEditor"
How do I get the client side events to work with a webtextedit control in a UserControl? I have this code.
<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="MultiLineTextEditWithCharacterCount.ascx.cs" Inherits="CharityCheck.MultiLineTextEditWithCharacterCount" %><%@ Register tagprefix="ig" namespace="Infragistics.Web.UI.EditorControls" Assembly="Infragistics35.Web.v9.2, Version=9.2.20092.2056, Culture=neutral, PublicKeyToken=7dd5c3163f2cd0cb" %>
<ig:WebTextEditor ID="webTextEditor1" runat="server" BorderWidth="1px" BorderColor="#898989" Width="480px" Height="90px" TextMode="MultiLine"> </ig:WebTextEditor><br /><asp:PlaceHolder ID="PlaceHolder1" runat="server"></asp:PlaceHolder>
I then do this in the Page_Load method of the UserControl based class:
scriptText = "<script type=\"text/javascript\" id=\"igClientScript\">\n" + " function keyPressInEdit(oEdit, keyCode, oEvent) {\n" + " var text = oEdit.get_value();\n" + " var ar = text.split(' ')\n" + " if (ar.length >= " + this.MaxWordCount + ")\n" + " oEvent.cancel = true;\n" + " }\n" + "</script>\n";
Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "keyPressInEdit", scriptText); webTextEditor1.Attributes.Add("onkeypress", "keyPressInEdit(oEdit, keyCode, oEvent)");
When I run the page with the UserControl in it and type a character in the webtexteditor, the debugger stops in the javacode at the keyPressInEdit method saying the oEdit is undefined. keyCode and oEvent are also undefined. What do I have to do to make this work
Thank You all, I could not tecute the javascript within an vbscript window - so I don't know aspx nor xslt.
I just wanted the Webtextedit - to change backround color when no value was found. Thats why i thought of executing in the submit (vbscript) code or invalidvalue method.
Thank You
Hi,
WebTextEdit and all other Infragistics controls support only javascript client side events.
If you have problems with manual writing <script> blocks, then try following:
1. Open aspx in Design view2. Right mouse click on WebTextEdit and select Properties3. Find ClientSideEvents, select event which you are interested in and click drop-down button which should appear for that property4. In drop-down list select "Add new handler..."5. In dialog which should appear, you may modify name of your handler or keep default value6. Click OK7. Designer should switch to Source view and point you to the content of that function.8. To test/debug/implement that function you may start with typing-in something simple like alert("my handler");9. Run page and confirm that alert appears on that event.10. Do your implementation. To check if it is executed without exceptions you may put alert("#") after every statement and validate that all alerts are fired. You also insert debugger; statement at any point in you codes and verify flow of logic.
Hi, I'm coding in an application that uses VBscripting code, I can only uses javascript in it's Clientside Properties.
On this application I have to use vbscripting, how do I get this do be done in vbscript or execute the javascript within the vbscript window?