Esempio n. 1
0
    /// <summary>
    /// Registers the client script with the Page object using a key and a URL, which enables the script to be called from the client.
    /// </summary>
    private void RegisterScripts()
    {
        if (!IsPostBack)
        {
            string OrganizationName = string.Empty;
            string ProfileOrg       = string.Empty;
            if (Organization != null)
            {
                ProfileOrg       = NexsoHelper.GetCulturedUrlByTabName("insprofile") + "/in/" + Organization.OrganizationID;
                OrganizationName = Organization.Name;
            }

            Page.ClientScript.RegisterClientScriptInclude(
                this.GetType(), "countryStateCity", ControlPath + "resources/js/countryStateCity.js");

            if (address.Value != string.Empty)
            {
                if (string.IsNullOrEmpty(ValidateSecurity.ValidateString(address.Value, false)))
                {
                    lblMessage.ErrorMessage = Localization.GetString("InvalidFormat", LocalResourceFile);
                    lblMessage.IsValid      = false;
                    return;
                }
            }
            string script = "<script>" +

                            "var iconGenOrg" + this.ClientID + "='" + String.Format("{0}Images/organizationbldg.png", PortalSettings.HomeDirectory) + "';"
                            +
                            "var iconGenTestLocation" + this.ClientID + "='" + String.Format("{0}Images/testlocationcrc.png", PortalSettings.HomeDirectory) + "';"
                            +
                            "var profileOrg" + this.ClientID + "='" + ProfileOrg.ToString().ToLower() + "';"
                            +
                            "var orgName" + this.ClientID + "='" + OrganizationName.ToLower() + "';"
                            +
                            "var iconGenIni" + this.ClientID + "='" + String.Format("{0}Images/marker-yellow.png", PortalSettings.HomeDirectory) + "';"
                            +
                            //"var iconGenOrg" + this.ClientID + "='" + String.Format("{0}Images/marker-blue.png", PortalSettings.HomeDirectory) + "';"
                            //+
                            "var multiSelectIni" + this.ClientID + "=" + MultiSelect.ToString().ToLower() + ";"
                            +
                            "var addressRequiredIni" + this.ClientID + "=" + AddressRequired.ToString().ToLower() + ";"

                            +
                            "var viewInEditModeIni" + this.ClientID + "=" + ViewInEditMode.ToString().ToLower() + ";"
                            +
                            "var addressPlaceHolderIni" + this.ClientID + "='" + GetLabelAddresPlaceHolder() + "';"
                            +
                            "var cscPlaceHolderIni" + this.ClientID + "='" + GetLabelCityStateCountryPlaceHolder() + "';"
                            +
                            "function load" + ClientID + "(){initializemap(document.getElementById('map_canvas" +
                            ClientID + "'), document.getElementById('" + pac_input.ClientID +
                            "'), document.getElementById('" + address.ClientID +
                            "'),document.getElementById('btnGeocode" + ClientID + "'),document.getElementById('" +
                            hdVal1.ClientID + "'),'" + this.ClientID + "');}" +

                            "$(document).ready(function () {Sys.WebForms.PageRequestManager.getInstance().add_pageLoaded(load" +
                            ClientID + ");Sys.WebForms.PageRequestManager.getInstance().add_endRequest(load" + ClientID +
                            ");});" +


                            "</script>";


            Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "script" + ClientID, script);
            rfvAddress.Visible = LocationRequired;
        }
    }