Thursday, March 24, 2011

Definitions for ASP.NET Viewstate

ASP.NET view state is the technique used by an ASP.NET Web page to persist changes to the state of a Web Form across postbacks
From:

ASP.NET page framework uses to preserve page and control values between round trips

Wednesday, March 23, 2011

How to add JavaScript function before request or after request for ACT Update Panel?

PageRequestManager
                Sys.WebForms.PageRequestManager.getInstance().add_beginRequest(BeginRequestHandler);
                Sys.WebForms.PageRequestManager.getInstance().add_endRequest(EndRequestHandler);
                function BeginRequestHandler(sender, args)
                {
                     var elem = args.get_postBackElement();
                     ActivateAlertDiv('visible', 'AlertDiv', elem.value + ' processing...');
                }
                function EndRequestHandler(sender, args)
                {
                     ActivateAlertDiv('hidden', 'AlertDiv', '');
                }


In ASP.NET, ENTER key on a FORM with a single Input Field, will automatically SUBMIT.

This happens in IE, Chrome, but not in Firefox.
Solution: add another hidden input field. Such as:

<div style="display: none">
    <input type="text" name="hiddenText" />
</div>


Reason:
Because IE and Chrome following HTML2.0 Specification exactly.
According to HTML2.0 Specification, 8.2. Form Submission:

When there is only one single-line text input field in a form, the
   user agent should accept Enter in that field as a request to submit
   the form.


Tuesday, March 22, 2011

CLEDITOR - JQuery WYSIWYG HTML EDITOR

CLEditor is an open source jQuery plugin which provides a lightweight, full featured, cross browser, extensible, WYSIWYG HTML editor which can be easily added into any web site


Demo
http://premiumsoftware.net/cleditor/

jQuery Mobile CDN

<link rel="stylesheet" href="http://code.jquery.com/mobile/1.0a3/jquery.mobile-1.0a3.min.css" />
<script src="http://code.jquery.com/jquery-1.5.min.js"></script>
<script src="http://code.jquery.com/mobile/1.0a3/jquery.mobile-1.0a3.min.js"></script>