示例#1
0
 protected override void RegisterScriptsAndServices(System.Web.UI.ScriptManager manager)
 {
     manager.Scripts.Add(new ScriptReference("jscripts/product_ajax.js"));
     manager.Scripts.Add(new ScriptReference("jscripts/kitProduct_ajax.js"));
     manager.Scripts.Add(new ScriptReference("jscripts/productcompare.js"));
     manager.Services.Add(new ServiceReference("~/actionservice.asmx"));
 }
 protected override void RegisterScriptsAndServices(System.Web.UI.ScriptManager manager)
 {
     manager.Scripts.Add(new ScriptReference("js/product_ajax.js"));
     manager.Scripts.Add(new ScriptReference("js/kitProduct_ajax.js"));
     manager.Scripts.Add(new ScriptReference("js/tooltip.js"));
     //manager.Scripts.Add(new ScriptReference("js/jquery/jquery.touchwipe.min.js"));
     manager.Services.Add(new ServiceReference("~/actionservice.asmx"));
 }
示例#3
0
 /// <summary>
 /// Register the current control for post back ajax events
 /// </summary>
 /// <param name="scriptManagerID">The current script manager id to to register against</param>
 /// <param name="control">The control to register post back events</param>
 public static void RegisterPostBackControl(String scriptManagerID, System.Web.UI.Control control)
 {
     // Get the script manager and register the
     // control with the script manager.
     System.Web.UI.ScriptManager scriptManager = GetScriptManager(scriptManagerID, control.Page);
     if (scriptManager != null)
     {
         scriptManager.RegisterPostBackControl(control);
     }
 }
示例#4
0
        /// <summary>
        /// Create a new script manager as the first control on the page form.
        /// </summary>
        /// <param name="page">The page to add the script manager to.</param>
        /// <returns>The script manager id.</returns>
        public static string AddScriptManager(System.Web.UI.Page page)
        {
            // Make sure the page reference exists.
            if (page == null)
            {
                throw new ArgumentNullException("page");
            }

            // Get the existing script manager.
            string scriptManagerID = "ScriptManager99";

            System.Web.UI.ScriptManager scriptManager = GetScriptManager(scriptManagerID, page);

            // If a script manager does not exist
            if (scriptManager == null)
            {
                // Create a new script manager.
                using (scriptManager = new ScriptManager()
                {
                    ID = scriptManagerID,
                    EnableScriptGlobalization = true,
                    EnableScriptLocalization = true,
                }
                       )
                {
                    // Add the script manager to the first
                    // control on the form.
                    page.Form.Controls.AddAt(0, scriptManager);

                    // Add an indicator for the current session
                    // that the script manager has been added.
                    if (HttpContext.Current.Items["System.Web.UI.ScriptManager"] == null)
                    {
                        HttpContext.Current.Items.Add("System.Web.UI.ScriptManager", true);
                    }

                    // Return the script manager id.
                    return(scriptManager.ID);
                }
            }
            else
            {
                // Return the script manager id.
                return(scriptManager.ID);
            }
        }
示例#5
0
 protected override void OnLoadComplete(EventArgs e)
 {
     if (this.Page.Master != null)
     {
         this.manager = this.Page.Master.FindControl("ContentPlaceHolder1").FindControl("ScriptManager1") as System.Web.UI.ScriptManager;
     }
     else
     {
         this.manager = this.Page.FindControl("ScriptManager1") as System.Web.UI.ScriptManager;
     }
     if (this.manager != null)
     {
         this.manager.AsyncPostBackError += new EventHandler <AsyncPostBackErrorEventArgs>(this.manager_AsyncPostBackError);
         this.manager.Scripts.Add(new ScriptReference("~/js/bav/BAV.js"));
         this.manager.Scripts.Add(new ScriptReference("~/js/bav/Caching.js"));
         this.manager.Scripts.Add(new ScriptReference("~/js/bav/disable.js"));
         this.manager.Scripts.Add(new ScriptReference("~/js/bav/timesession.js"));
         this.manager.Scripts.Add(new ScriptReference("~/js/bav/functions.js"));
     }
     else
     {
         if (!this.Page.ClientScript.IsStartupScriptRegistered("BAV"))
         {
             this.Page.ClientScript.RegisterClientScriptInclude(base.GetType(), "BAV", string.Concat(this.Page.ResolveUrl("~"), "js/bav/BAV.js"));
         }
         if (!this.Page.ClientScript.IsStartupScriptRegistered("BAVCaching"))
         {
             this.Page.ClientScript.RegisterClientScriptInclude(base.GetType(), "BAVCaching", string.Concat(this.Page.ResolveUrl("~"), "js/bav/Caching.js"));
         }
         if (!this.Page.ClientScript.IsStartupScriptRegistered("BAVDisable"))
         {
             this.Page.ClientScript.RegisterClientScriptInclude(base.GetType(), "BAVDisable", string.Concat(this.Page.ResolveUrl("~"), "js/bav/disable.js"));
         }
         if (!this.Page.ClientScript.IsStartupScriptRegistered("BAVTimesession"))
         {
             this.Page.ClientScript.RegisterClientScriptInclude(base.GetType(), "BAVTimesession", string.Concat(this.Page.ResolveUrl("~"), "js/bav/timesession.js"));
         }
         if (!this.Page.ClientScript.IsStartupScriptRegistered("BAVFuntions"))
         {
             this.Page.ClientScript.RegisterClientScriptInclude(base.GetType(), "BAVFuntions", string.Concat(this.Page.ResolveUrl("~"), "js/bav/functions.js"));
         }
     }
     base.OnLoadComplete(e);
 }
示例#6
0
        protected override void OnInit(EventArgs e)
        {
            //se o div de Aguarde ainda estiver mostrando ele tira
            System.Web.UI.ScriptManager src = ScriptManager.GetCurrent(Page);
            if (src != null)
            {
                ScriptManager.RegisterClientScriptBlock(this, typeof(void), "TiraDivAguarde", "if(document.getElementById('divProcessando'))document.getElementById('divProcessando').style.display = 'none';", true);
            }
            else
            {
                ClientScript.RegisterStartupScript(typeof(Page), "TiraDivAguarde", "if(document.getElementById('divProcessando'))document.getElementById('divProcessando').style.display = 'none';", true);
            }

            ClientScript.RegisterOnSubmitStatement(this.GetType(), "zerarfiltro", "if(document.getElementById('divProcessando') && document.getElementById('divProcessando').style.display!='none')return false;");

            ClientScript.RegisterOnSubmitStatement(this.GetType(), "Aguarde", "if (typeof(ValidatorOnSubmit) == 'function' && ValidatorOnSubmit() == false) return false; avisoAguarde();");

            base.OnInit(e);
        }
示例#7
0
    protected void txtRefNo_TextChanged(object sender, EventArgs e)
    {
        System.Web.UI.ScriptManager smHdr = Page.FindControl("MyScript") as System.Web.UI.ScriptManager;

        if (ViewState["ListStatus"] != null && ViewState["ListStatus"] != "Pending")
        {
            if (ger.DupBOL(txtRefNo.Text.ToString()))
            {
                //txtRefNo.Text = "DUPLICATE BOL";
                smHdr.SetFocus(txtRefNo);
                System.Web.UI.ScriptManager.RegisterClientScriptBlock(pnlBOL, typeof(System.Web.UI.UpdatePanel), "Script", "alert('BOL " + txtRefNo.Text.ToString() + " already exists');", true);
                txtRefNo.Text = "";
            }
            else
            {
                smHdr.SetFocus(txtBOLDt);
            }

            pnlBOL.Update();
        }
    }
示例#8
0
        protected override void RegisterScriptsAndServices(System.Web.UI.ScriptManager manager)
        {
            StringBuilder sb = new StringBuilder();

            sb.Append("<script type='text/javascript'>");
            sb.Append("$(document).ready(");
            sb.Append(" function() { ");
            sb.Append(string.Format(" ise.Configuration.registerConfig('ImageZoomLensWidth', '{0}');", AppLogic.AppConfig("ImageZoomLensWidth")));
            sb.Append(string.Format(" ise.Configuration.registerConfig('ImageZoomLensHeight', '{0}');", AppLogic.AppConfig("ImageZoomLensHeight")));
            sb.Append(" });");
            sb.Append("</script>");
            ScriptManager.RegisterClientScriptBlock(this.Page, this.GetType(), "ImageZoomSize", sb.ToString(), false);

            manager.Scripts.Add(new ScriptReference("jscripts/product_ajax.js"));
            manager.Scripts.Add(new ScriptReference("jscripts/kitProduct_ajax.js"));
            manager.Scripts.Add(new ScriptReference("jscripts/tooltip.js"));
            manager.Scripts.Add(new ScriptReference("jscripts/imagezoom.js"));
            manager.Scripts.Add(new ScriptReference("jscripts/productcompare.js"));
            manager.Scripts.Add(new ScriptReference("jscripts/carousel.js"));
            manager.Services.Add(new ServiceReference("~/actionservice.asmx"));
        }
示例#9
0
        public static void InitScript(Page p)
        {
            // load init scripts
            if (!p.ClientScript.IsStartupScriptRegistered("wb-frmvld-init"))
            {
                // load custom scripts
                System.Web.UI.ScriptManager sm = System.Web.UI.ScriptManager.GetCurrent(p);
                if (sm == null)
                {
                    throw new System.Exception("You must have a script manager in your page.");
                }

                sm.Scripts.Add(new System.Web.UI.ScriptReference("WetControls.Scripts.wetscripts.js", "WetControls"));

                string script = @"wrapForm();
                                Sys.WebForms.PageRequestManager.getInstance().add_endRequest(wrapForm);
                                Sys.WebForms.PageRequestManager.getInstance().add_initializeRequest(onEachRequest);";

                p.ClientScript.RegisterStartupScript(typeof(string), "wb-frmvld-init", script, true);
            }
        }
        private void SummaryScript()
        {
            // catch the event to position the summary
            if (!this.Page.ClientScript.IsStartupScriptRegistered("wb-frmvld-summary"))
            {
                // load script
                System.Web.UI.ScriptManager sm = System.Web.UI.ScriptManager.GetCurrent(this.Page);
                if (sm == null)
                {
                    throw new Exception("You must have a script manager in your page.");
                }

                sm.Scripts.Add(new System.Web.UI.ScriptReference("WetControls.Scripts.ready.js", "WetControls"));

                string action = this.DisplaySummary ? "$(element).appendTo('#" + this.ClientID + "');" : "$(element).hide();";
                string script = @"// Detect element availability on the initial page load and those dynamically appended to the DOM
                                  var formId = $('form').attr('id');
                                  var errorFormId = '#errors-' + (!formId ? 'default' : formId);
                                  ready(errorFormId, function(element) { " + action + "});";

                this.Page.ClientScript.RegisterStartupScript(typeof(string), "wb-frmvld-summary", script, true);
            }
        }
    /// <summary>
    /// Saves the view state to the Web server file system.
    /// </summary>
    protected override void SavePageStateToPersistenceMedium(object state)
    {
        // save the view state to disk based on the user's ID and the URL

        // serialize the view state into a base-64 encoded string
        StringWriter stringWriter = new StringWriter();

        System.Web.UI.LosFormatter los = new System.Web.UI.LosFormatter();
        StringWriter sw = new StringWriter();

        los.Serialize(sw, state);
        string vs = sw.ToString();

        byte[] bytes = Convert.FromBase64String(vs);
        // bytes = Compressor.Compress(bytes);

        System.Web.UI.ScriptManager sm = System.Web.UI.ScriptManager.GetCurrent(this);
        if (sm != null && sm.IsInAsyncPostBack)
        {
            System.Web.UI.ScriptManager.RegisterHiddenField(this, "__VSTATE", vs);
        }

        String folderPath = Path.Combine(Request.PhysicalApplicationPath, "PersistedViewState");

        // check folder exists
        if (Directory.Exists(folderPath) == false)
        {
            Directory.CreateDirectory(folderPath);
        }

        // save the string to disk
        StreamWriter streamWriter = File.CreateText(ViewStateFilePath);

        streamWriter.Write(Convert.ToBase64String(bytes));
        streamWriter.Close();
        sw.Close();
    }
示例#12
0
 protected override void RegisterScriptsAndServices(System.Web.UI.ScriptManager manager)
 {
     manager.Scripts.Add(new ScriptReference("js/address_ajax.js"));
     manager.Services.Add(new ServiceReference("~/actionservice.asmx"));
 }
 protected override void RegisterScriptsAndServices(System.Web.UI.ScriptManager manager)
 {
     manager.Scripts.Add(new ScriptReference("jscripts/imagezoom.js"));
 }