adsense

Friday, November 18, 2016

ASP.Net MVC set maximum upload file size

ASP.NET MVC provides some configuration settings that enable to upload larger files. Adding following code snippet to web.config file will increase the maximum file upload size.

 <location path="controller/action">
   <system.web>
     <!-- specified in kilobytes (KB)  -->
    <httpRuntime maxRequestLength="15360" />  <!-- 15MB -->
   </system.web>
  <system.webServer>
     <security>
       <requestFiltering>
         <!-- specified is in bytes (B)  -->
         <requestLimits maxAllowedContentLength="15728640"/>  <!-- 15MB -->
       </requestFiltering>
     </security>
   </system.webServer>
 </location>

Cheer,
Samitha

Friday, November 11, 2016

Multiline Button Text

If you ever wanted to display a long button text in multiple lines  CSS comes to assist you. You can achieve the effect using following style.

#button_id {
    white-space: normal;
    width: 100px;
  height: 80px;
}

Make sure you have set the with and height for the button .

cheers
Samitha

Thursday, November 3, 2016

loop through all hyperlink elements using jQuery

If you ever wanted to loop through all the hyperlink elements in a page, jQuery provides .each() function which will provide you the desired result.

e.g
$("a").each(function(){
    //access the element here.
});

This can also be done in a more cleaner way as displayed below.

$("a").attr("href", function(i, hRef) {
  //access the element here.
});

I prefer the second option as will not create additional object when iterating elements.

Cheers,
Samitha