Skip to main content

Posts

Showing posts from June, 2013

Using jQuery to center a DIV on the screen

I like adding functions to jQuery so this function would help: jQuery . fn . center = function () { this . css ( "position" , "absolute" ); this . css ( "top" , Math . max ( 0 , (( $ ( window ). height () - $ ( this ). outerHeight ()) / 2 ) + $ ( window ). scrollTop ()) + "px" ); this . css ( "left" , Math . max ( 0 , (( $ ( window ). width () - $ ( this ). outerWidth ()) / 2 ) + $ ( window ). scrollLeft ()) + "px" ); return this ; } $.fn.center = function () { this.css({ 'position': 'fixed', 'left': '50%', 'top': '50%' }); this.css({ 'margin-left': -this.width() / 2 + 'px', 'margin-top': -this.h

Sys.WebForms.PageRequestManagerServerErrorException: … The status code returned from the server was: 404

Error :  Sys . WebForms . PageRequestManagerServerErrorException : An unknown error occurred while processing the request on the server . The status code returned from the server was : 404 Solution :  I used HTTPWatch to get the URL the request was being posted to. This showed me the URL was Appending to the existing URL each post and not overwriting. I used some JavaScript at the top of my page to set the forms URL to the window location: Sys . Application . add_load ( function () { var form = Sys . WebForms . PageRequestManager . getInstance (). _form ; form . _initialAction = form . action = window . location . href ; }); This sorted it. Hope it helps someone else. Ref :  http://stackoverflow.com/questions/2385737/sys-webforms-pagerequestmanagerservererrorexception-the-status-code-return

How do I make an editable DIV look like a text field?

These look the same as their real counterparts in Safari, Chrome, and Firefox. They degrade gracefully and look OK in Opera and IE9, too. Demo:  http://jsfiddle.net/ThinkingStiff/AbKTQ/ CSS textarea { height : 28px ; width : 400px ; } # textarea { -moz-appearance : textfield-multiline ; -webkit-appearance : textarea ; border : 1px solid gray ; font : medium -moz-fixed ; font : -webkit-small-control ; height : 28px ; overflow : auto ; padding : 2px ; resize : both ; width : 400px ; } input { margin-top : 5px ; width : 400px ; } # input { -moz-appearance : textfield ; -webkit-appearance : textfield ; background-color : white ; background-color : -moz-field ; border : 1px solid darkgray ; box-shadow : 1px 1px 1px 0 lightgray inset ; font : -moz-field ; font : -webkit-small-control ; margin-top : 5px ; padding : 2px 3px ;

Best Practices to Improve ASP.NET Web Application Performance

Introduction Performance tuning can be tricky. It's especially tough in Internet-related projects with lots of components running around, like HTML client, HTTP network, Web server, middle-tier components, database components, resource-management components, TCP/IP networks, and database servers. Performance tuning depends on a lot of parameters and sometimes, by changing a single parameter, performance can increase drastically. This document lists out some tips for optimizing ASP.NET Web applications and many traps and pitfalls are discussed. Tips For Web Application Turn off Tracing unless until required Tracing is one of the wonderful features which enables us to track the application's trace and the sequences. However, again it is useful only for developers and you can set this to " false " unless you require to monitor the trace logging. How it affects performance Enabling tracing adds performance overhead and might expose private information, so it sh