Tuesday, February 28, 2012

Adding Content To TinyMCE using javascript

If you ever want to add content to tinymce using javascipt. You can use the following code.

<script type="text/javascript">
window.onload = function () {
    tinyMCE.activeEditor.setContent('some html content here');
}
</script>

or using jQuery

<script type="text/javascript">
 $(function () {
      tinyMCE.activeEditor.setContent('some html content here');
 });
</script>

It requires you have only one tinyMCE editor. But if you have more you can use this.

tinyMCE.editors[index0].setContent('some html content here');
tinyMCE.editors[index1].setContent('some html content here');
tinyMCE.editors["nameOfEditor"].setContent('some html content here');

Hope this helps!

Monday, January 10, 2011

Flash movie blocking your menu or anything else

If you added an flash movie on your page and also added a drop down menu on top of it. Chances are you wont see the drop down menu because flash object hides it.

To get rid of this problem you just need to set the parameter “wmode” (Window Mode) to transparent in object properties.

e.g.
<object classid="clsid:166B1BCA-3F9C-11CF-8075-444553540000"  
codebase="http://download.macromedia.com/pub/shockwave/cabs/
director/sw.cab#version=10,1,1,0"
        width="?" height="?">
        <param name="src" value="?.swf" />
        <param name="wmode" value="transparent" />
        <embed src="?.swf" width="?" height="?" 
 pluginspage="http://www.adobe.com/shockwave/download/"  
wmode="transparent"></embed>
</object>


Thats it

Friday, December 3, 2010

Parsing UK Date in javascript

To reach a date object with UK format in javascript has no straight road. Well you can use split map to reach there.
Consider this example
var ukDate = new Date("01/12/2011");
well for javascript it is
Wed Jan 12 2011 00:00:00
but we can use the split() object to first separate the date using “/” as separator and then create the Date Object
Consider this example
var ukDate="01/12/2011";
var dateArray=ukDate.split("/");
var newDate=new Date(dateArray[2], dateArray[1]-1,dateArray[0]);
 
not output will be
Thu Dec 01 2011
and your are done

Thursday, December 2, 2010

Masterpage's button event not firing

Add this to buttons attributes
CausesValidation="false" UseSubmitBehavior="false"
Also check if there are any validators on the content page with no ValidationGroup

A potentially dangerous Request.Form value was detected from the client

You may see this error when you are insert html in asp.net forms. To fix this just append this at the top of page

ValidateRequest="false"
But if you are using dot net framework 4, you also need to add this in the web.config file

<httpRuntime requestValidationMode="2.0"></httpRuntime>
and you are done.

For selected folders use "location" object inside folder and place above code inside that

<location path="{path}">
    <system.web>
        <httpRuntime requestValidationMode="2.0" />
    </system.web> 
</location>