Another work-around to set maximum character length allowable to a textbox.



JavaScript Code:

function TextboxMultilineMaxNumber(txt, maxLen) {
            try {
                if (txt.value.length > (maxLen - 1)) {
                    alert("Maximum allowable characters reached.");
                    return false;
                }
            }
            catch (e) {
            }
        }

HTML(DOM) Code:

 <asp:TextBox ID="CourseName" runat="server" Width="615px" onkeypress="return TextboxMultilineMaxNumber(this,110)"></asp:TextBox>


L.
Another trick or work-around (i think) to make jQuery work right after UpdatePanel server request.

On my example code below, I have a textbox that has class name "datefield" that shows jQuery date picker (date calendar) when you click the textbox.


Javascript:

function load() {
Sys.WebForms.PageRequestManager.getInstance().add_endRequest(EndRequestHandler);
}

function EndRequestHandler() {
 AsyncDone();
}


function AsyncDone() {
 $(".datefield").datepicker();
}


jQuery(document).ready(function ($) {
                        AsyncDone();
                    });




C# codebehind
ScriptManager.RegisterStartupScript(UpdateThis, typeof(UpdatePanel), "EndRequest", "load();", true);


L.