Monday, November 25, 2019

jQuery modal Close contains additional text

if you are using jQuery modal you might see that the modal close icon has Close text alongside it.

This can be fixed using a simple css as displayed below.

<style type="text/css" >

.ui-button-icon-only {
   text-indent: -9999px;
}

</style>

Cheers
Samitha

Thursday, November 14, 2019

The CodeDom provider type “Microsoft.CodeDom.Providers.DotNetCompilerPlatform.CSharpCodeProvider” could not be located

You might have encountered above error when trying to run a Asp.net MVC project.

The cause of this issue is version changes in DotNetCompilerPlatform.dll. Check your web.config and make sure you have latest version as displayed below.

 <system.codedom>
         <compilers>

             <compiler language="c#;cs;csharp" extension=".cs" type="Microsoft.CodeDom.Providers.DotNetCompilerPlatform.CSharpCodeProvider, Microsoft.CodeDom.Providers.DotNetCompilerPlatform, Version=2.0.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" warningLevel="4" compilerOptions="/langversion:6 /nowarn:1659;1699;1701" />

             <compiler language="vb;vbs;visualbasic;vbscript" extension=".vb" type="Microsoft.CodeDom.Providers.DotNetCompilerPlatform.VBCodeProvider, Microsoft.CodeDom.Providers.DotNetCompilerPlatform, Version=2.0.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" warningLevel="4" compilerOptions="/langversion:14 /nowarn:41008 /define:_MYTYPE=\"Web\" /optionInfer+" />
         </compilers>

     </system.codedom>

Cheers
Samitha

Friday, October 18, 2019

Including js file

We can uses jQuery to import, include or require a js file within another js as shown below.


$.getScript("filename.js", function(){

   alert("filename.js loaded.");

});

Cheers,
Samitha

Tuesday, September 17, 2019

Chrome missing layout options in print preview

When trying to print a website in Chrome, you might see that print preview does not display the layout options to select.

This can be cause by two things.

1.Setting a custom @page size declaration in the Print  CSS
2. Integration of bootstrap


In both the above cases a custom @page size is given in the Print CSS and make sure you have set size: auto;  as shown below to resolve the issue.

@media print {
    @page {
        size: auto;
    }
}

Cheers,
Samitha

Tuesday, August 27, 2019

asp.net override style of an iframe

We can use jQuery to style the body or an element in an IFRAM E as shown below.


<script type="text/javascript">

$('#iframeID').load( function() {
    $(#'iframeID').contents().find("head")
       .append($("<style type='text/css'>  .className{display:none;}  </style>"));
});

</script>

Cheers,
Samitha

Friday, August 16, 2019

Remove resize grip on multiline textboxes

We can use css to easily remove the resize grip shown on multi line text boxes as shown below.

<style type="text/css">

textarea {
   resize: none;
}

</style>

Cheers,
Samitha

Wednesday, July 31, 2019

Restrict special characters

You can use JavaScript key press event to restrict special characters as shown below.

<script type="text/javascript">

 //this event can be attached in pageLoad or DOM Ready
function pageLoad() {

 var specialCharsArray = [61, 62, 33, 36, 64, 35, 37, 94, 38, 42, 40, 96, 126, 40, 41, 43];
//this array can be used to specify all the special characters

//the element can be an id of a textbox or in general input type=text
                element.bind("keypress", function (event) {
                     //check array
                    if ($.inArray(event.which, specialCharsArray ) != -1) {
                        event.preventDefault(); //prevent default event handle
                    }
                });

}
</script>



Use this link to test key code values.

Cheers,
Samitha