Skip to main content

Posts

Showing posts from March, 2012

getting only file name from fileupload control and checking for special character in file name :-JQuery

function ValidateThumbnail() {
//get file name
        var path = $("[id$=fileUploadControl]").val();
        var pos = path.lastIndexOf(path.charAt(path.indexOf(":") + 1));

        var f = path.substring(pos + 1);
       //check for special char
        if ((f.indexOf("#", 0) >= 0)
        || (f.indexOf("&", 0) >= 0)
        || (f.indexOf("*", 0) >= 0)
        || (f.indexOf(";", 0) >= 0)
        || (f.indexOf("$", 0) >= 0)
        || (f.indexOf("%", 0) >= 0)
        || (f.indexOf("^", 0) >= 0)
        || (f.indexOf("{", 0) >= 0)
        || (f.indexOf("}", 0) >= 0)
        || (f.indexOf("|", 0) >= 0)
        || (f.indexOf("/", 0) >= 0)
        || (f.indexOf("?", 0) >= 0)
        || (f.indexOf("~", 0) >= 0)
        || (f.indexOf(":", 0) >= 0)
        || (f.indexOf("<", …

JQuery POP UP during page load /Post back

give call to below fuction on client click

function ShowLoading(e) {
        var div = document.createElement('div');
        var img = document.createElement('img');
        img.src = '/_layouts/Portal/Images/ajax-loader-1.gif';
        div.innerHTML = "Please wait...<br />";
        div.style.cssText = 'position: fixed; top: 30%; left: 40%; z-index: 5000; width: 222px; text-align: center; background: #fff; border: 1px solid #000';
        div.appendChild(img);
        document.body.appendChild(div);

    }

TaxonomyWebTaggingControl in UpdatePanel with AJAX

When asyncronuous postback will happen it will not load the TaxonomyWebTaggingControl because DOM gets null.
Use below methode to load TaxonomyWebTaggingControl  after asyn postback.

private string GetReloadJavaScript(TaxonomyWebTaggingControl taxonomyControl)
        {
            String script = String.Empty;

            String containerId = SPEncode.ScriptEncode(taxonomyControl.Controls[1].ClientID);
            Type type_TaxonomyWebTaggingControl = typeof(TaxonomyWebTaggingControl);
            MethodInfo mi_getOnloadJavascript = type_TaxonomyWebTaggingControl.GetMethod("getOnloadJavascript", BindingFlags.NonPublic | BindingFlags.Instance);
            String fullScript = (String)mi_getOnloadJavascript.Invoke(taxonomyControl, null);
            int pos = fullScript.IndexOf(String.Format("function {0}_load()", containerId));
            if (pos > -1)
            {
                StringBuilder builder = new StringBuilder();
                builder.Append("…