当前位置: 移动技术网 > IT编程>开发语言>.net > C# 跳转新的标签页

C# 跳转新的标签页

2019年02月23日  | 移动技术网IT编程  | 我要评论

邵东夜总会发生火灾,放飞梦想演讲稿,笨小孩龙城辅助

///这个是拿别人的,找到好多这个方法,溜了,不知道谁是原创

protected void btnprint_click(object sender, eventargs e)
        {
            string url = "qr_codeprintview.aspx?code=" + tbassetcode.text + ";";
            redirect(response, url, "_blank", "'toolbar=0,scrollbars=1,status=0,menubar=0,resizable=1,top=0,left=0,height=800,width=1000");
        }
        /// <summary>
        /// 打开新的标签页
        /// </summary>
        /// <param name="response"></param>
        /// <param name="url"></param>
        /// <param name="target"></param>
        /// <param name="windowfeatures"></param>
        private void redirect(httpresponse response, string url, string target, string windowfeatures)
        {
            if ((string.isnullorempty(target) || target.equals("_self", stringcomparison.ordinalignorecase)) && string.isnullorempty(windowfeatures))
            {
                response.redirect(url);
            }
            else
            {
                page page = (page)httpcontext.current.handler;
                if (page == null)
                {
                    throw new
                    invalidoperationexception("cannot redirect to new window .");
                }
                url = page.resolveclienturl(url);
                string script;
                if (!string.isnullorempty(windowfeatures))
                {
                    script = @"window.open(""{0}"", ""{1}"", ""{2}"");";
                }
                else
                {
                    script = @"window.open(""{0}"", ""{1}"");";
                }
                script = string.format(script, url, target, windowfeatures);
                scriptmanager.registerstartupscript(page, typeof(page), "redirect", script, true);
            }
        }

如对本文有疑问,请在下面进行留言讨论,广大热心网友会与你互动!! 点击进行留言回复

相关文章:

验证码:
移动技术网