• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# UI.Page类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中System.Web.UI.Page的典型用法代码示例。如果您正苦于以下问题:C# Page类的具体用法?C# Page怎么用?C# Page使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



Page类属于System.Web.UI命名空间,在下文中一共展示了Page类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: Boton_Excel_Dios_Click

        protected void Boton_Excel_Dios_Click(object sender, EventArgs e)
        {
            StringBuilder sb = new StringBuilder();
            StringWriter sw = new StringWriter(sb);
            HtmlTextWriter htw = new HtmlTextWriter(sw);

            Page page = new Page();
            HtmlForm form = new HtmlForm();
            GridView_Dios.DataSourceID = string.Empty;
            GridView_Dios.EnableViewState = false;
            GridView_Dios.AllowPaging = false;
            GridView_Dios.DataSource = LBPD.Logica_Mostrar_Precios();
            GridView_Dios.DataBind();
            page.EnableEventValidation = false;
            page.DesignerInitialize();
            page.Controls.Add(form);
            form.Controls.Add(GridView_Dios);
            page.RenderControl(htw);
            Response.Clear();
            Response.Buffer = true;
            Response.ContentType = "applicattion/vnd.ms-excel";
            Response.AddHeader("Content-Disposition", "attachment;filename=data.xls");
            Response.Charset = "UTF-8";
            Response.ContentEncoding = Encoding.Default;
            Response.Write(sb.ToString());
            Response.End();
        }
开发者ID:Gutylic,项目名称:Proyecto-Alfa,代码行数:27,代码来源:Precios_Dios.aspx.cs


示例2: GetRouteValue

        // Format will be <%$ RouteValue: Key %>, controlType,propertyName are used to figure out what typeconverter to use
        public static object GetRouteValue(Page page, string key, Type controlType, string propertyName) {
            if (page == null || String.IsNullOrEmpty(key) || page.RouteData == null) {
                return null;
            }

            return ConvertRouteValue(page.RouteData.Values[key], controlType, propertyName);
        }
开发者ID:krytht,项目名称:DotNetReferenceSource,代码行数:8,代码来源:RouteValueExpressionBuilder.cs


示例3: GetEditControl

        /// <summary>
        /// Returns the proper edit ascx Control. Uses the current Page to load the Control.
        /// If the user has no right a error control is returned
        /// </summary>
        /// <param name="p">The current Page</param>
        /// <returns>Edit ascx Control</returns>
        internal static Control GetEditControl(Page p)
        {
            PortalDefinition.Tab tab = PortalDefinition.GetCurrentTab();
            PortalDefinition.Module m = tab.GetModule(p.Request["ModuleRef"]);

            if(!UserManagement.HasEditRights(HttpContext.Current.User, m.roles))
            {
                // No rights, return a error Control
                Label l = new Label();
                l.CssClass = "Error";
                l.Text = "Access denied!";
                return l;
            }
            m.LoadModuleSettings();
            Module em = null;
            if(m.moduleSettings != null)
            {
                // Module Settings are present, use custom ascx Control
                em = (Module)p.LoadControl(Config.GetModuleVirtualPath(m.type) + m.moduleSettings.editCtrl);
            }
            else
            {
                // Use default ascx control (Edit[type].ascx)
                em = (Module)p.LoadControl(Config.GetModuleVirtualPath(m.type) + "Edit" + m.type + ".ascx");
            }

            // Initialize the control
            em.InitModule(
                tab.reference,
                m.reference,
                Config.GetModuleVirtualPath(m.type),
                true);

            return em;
        }
开发者ID:dineshkummarc,项目名称:DotNetPortalSrc-102,代码行数:41,代码来源:Helper.cs


示例4: IsClientScriptRegisteredInHeader

        public static bool IsClientScriptRegisteredInHeader(Page page, string key)
        {
            bool result = false;

            if (page.Header != null)
            {
                foreach (Control ctl in page.Header.Controls)
                {
                    if (ctl is HtmlGenericControl)
                    {
                        if (ctl.ID != null)
                        {
                            if (ctl.ID.Trim().Length != 0)
                            {
                                if (ctl.ID.Equals(key, StringComparison.OrdinalIgnoreCase))
                                {
                                    result = true;
                                    break;
                                }
                            }
                        }
                    }
                }
            }

            return result;
        }
开发者ID:vorman,项目名称:WebStats,代码行数:27,代码来源:Utility.cs


示例5: EnsureScriptManager

		/// <summary>
		/// 
		/// </summary>
		/// <param name="sm"></param>
		/// <param name="page"></param>
		public static void EnsureScriptManager(ref ScriptManager sm, Page page)
		{
			if (sm == null)
			{
				sm = ScriptManager.GetCurrent(page);
				if (sm == null)
				{
					ExceptionHelper.TrueThrow(page.Form.Controls.IsReadOnly, Resources.DeluxeWebResource.E_NoScriptManager);

					sm = new ScriptManager();

					//根据应用的Debug状态来决定ScriptManager的状态 2008-9-18
					bool debug = WebAppSettings.IsWebApplicationCompilationDebug();
					sm.ScriptMode = debug ? ScriptMode.Debug : ScriptMode.Release;

					sm.EnableScriptGlobalization = true;
					page.Form.Controls.Add(sm);
				}
			}
			else
			{
				ExceptionHelper.FalseThrow(sm.EnableScriptGlobalization, "页面中ScriptManger对象中属性EnableScriptGlobalization值应该设置为True!");
			}

			if (sm != null)
			{
				sm.AsyncPostBackError -= sm_AsyncPostBackError;
				sm.AsyncPostBackError += new EventHandler<AsyncPostBackErrorEventArgs>(sm_AsyncPostBackError);
			}
		}
开发者ID:jerryshi2007,项目名称:AK47Source,代码行数:35,代码来源:ScriptControlHelper.cs


示例6: AddJavaScriptText

 /// <summary>
 /// текст javascript в header
 /// </summary>
 /// <param name="jsText"></param>
 /// <param name="?"></param>
 public static void AddJavaScriptText(string jsText, Page page)
 {
     var script = new HtmlGenericControl("script");
     script.Attributes["type"] = "text/javascript";
     script.InnerText = jsText;
     page.Header.Controls.Add(script);
 }
开发者ID:blade-runner,项目名称:rutokenweb.asp.net,代码行数:12,代码来源:Utils.cs


示例7: AddScriptToPage

 /// <summary>
 /// референс на webresource
 /// </summary>
 /// <param name="scriptname"></param>
 /// <param name="page"></param>
 /// <returns></returns>
 public static void AddScriptToPage(string scriptname, Page page, Type t)
 {
     string s = page.ClientScript.GetWebResourceUrl(t,
                                                    "RutokenWebPlugin.javascript." + scriptname);
     page.ClientScript.RegisterClientScriptInclude(scriptname,
                                                   s);
 }
开发者ID:blade-runner,项目名称:rutokenweb.asp.net,代码行数:13,代码来源:Utils.cs


示例8: BasicControlUtils

        public BasicControlUtils()
        {
            bFoundPage = false;
            _page2 = null;

            _page = GetContainerPage(this);
        }
开发者ID:ninianne98,项目名称:CarrotCakeCMS,代码行数:7,代码来源:BasicControlUtils.cs


示例9: JudgeOperate

        public void JudgeOperate(Page page, int menuId, List<OperateEnum> operateTypes)
        {
            UserModel user = UserUtility.CurrentUser;

            try
            {
                AuthOperateBLL bll = new AuthOperateBLL();
                ResultModel result = bll.JudgeOperate(user, menuId, operateTypes);
                if (result.ResultStatus != 0)
                {
                    string oids = operateTypes.Aggregate(string.Empty, (current, operate) => current + (operate.ToString() + ","));

                    if (!string.IsNullOrEmpty(oids) && oids.IndexOf(',') > -1)
                        oids = oids.Substring(0, oids.Length - 1);

                    MenuBLL menuBLL = new MenuBLL();
                    result = menuBLL.Get(user, menuId);
                    if (result.ResultStatus != 0)
                        throw new Exception("获取菜单失败");

                    Menu menu = result.ReturnValue as Menu;

                    if (menu != null)
                    {
                        string redirectUrl = string.Format("{0}/ErrorPage.aspx?t={1}&r={2}", DefaultValue.NfmtSiteName, string.Format("用户无{0}-{1}权限", menu.MenuName, oids), string.Format("{0}MainForm.aspx",NFMT.Common.DefaultValue.NfmtSiteName));
                        page.Response.Redirect(redirectUrl,false);
                    }
                }
            }
            catch (Exception e)
            {
                log.ErrorFormat("用户{0},错误:{1}", user.EmpName, e.Message);
                page.Response.Redirect("/MainForm.aspx");
            }
        }
开发者ID:weiliji,项目名称:NFMT,代码行数:35,代码来源:VerificationUtility.cs


示例10: ProcessCancellation

        private void ProcessCancellation(
            Cart cart,
            Store store,
            WorldPayPaymentResponse wpResponse,
            PayPalLog worldPayLog,
            Page page)
        {
            //string serializedResponse = SerializationHelper.SerializeToString(wpResponse);
            //log.Info("received cancellation worldpay postback, xml to follow");
            //log.Info(serializedResponse);

            // return an html order cancelled template for use at world pay
            if (config.WorldPayProduceShopperCancellationResponse)
            {
                string htmlTemplate = ResourceHelper.GetMessageTemplate(CultureInfo.CurrentUICulture, config.WorldPayShopperCancellationResponseTemplate);
                StringBuilder finalOutput = new StringBuilder();
                finalOutput.Append(htmlTemplate);
                finalOutput.Replace("#WorldPayBannerToken", "<WPDISPLAY ITEM=banner>"); //required by worldpay
                finalOutput.Replace("#CustomerName", wpResponse.Name);
                finalOutput.Replace("#StoreName", store.Name);

                string storePageUrl = worldPayLog.RawResponse;

                finalOutput.Replace("#StorePageLink", "<a href='" + storePageUrl + "'>" + storePageUrl + "</a>");

                page.Response.Write(finalOutput.ToString());
                page.Response.Flush();

            }
        }
开发者ID:joedavis01,项目名称:mojoportal,代码行数:30,代码来源:WebStoreWorldPayResponseHandler.cs


示例11: HandleRequest

        public override bool HandleRequest(
            WorldPayPaymentResponse wpResponse,
            PayPalLog worldPayLog,
            Page page)
        {
            bool result = false;

            if (worldPayLog.SerializedObject.Length == 0) { return result; }

            Cart cart = (Cart)SerializationHelper.DeserializeFromString(typeof(Cart), worldPayLog.SerializedObject);

            Store store = new Store(cart.StoreGuid);
            //SiteSettings siteSettings = new SiteSettings(store.SiteGuid);
            config = SiteUtils.GetCommerceConfig();

            switch (wpResponse.TransStatus)
            {
                case "Y": //success
                    ProcessOrder(cart, store, wpResponse, worldPayLog, page);

                    result = true;
                    break;

                case "C": // cancelled
                default:
                    ProcessCancellation(cart, store, wpResponse, worldPayLog, page);
                    break;

            }

            return result;
        }
开发者ID:joedavis01,项目名称:mojoportal,代码行数:32,代码来源:WebStoreWorldPayResponseHandler.cs


示例12: TieButton

        public static void TieButton(Page page, Control TextBoxToTie, Control ButtonToTie)
        {
            // 初始化Jscript,实现原理是向客户端发送特定Jscript
            string jsString = "";
            // 检查输入框对应的事件按纽
            if (ButtonToTie is LinkButton)
            {
                jsString = "if ((event.which && event.which == 13) || (event.keyCode && event.keyCode == 13)) {" + page.ClientScript.GetPostBackEventReference(ButtonToTie, "").Replace(":", "$") + ";return false;} else return true;";
            }
            else if (ButtonToTie is ImageButton)
            {
                jsString = "if ((event.which && event.which == 13) || (event.keyCode && event.keyCode == 13)) {" + page.ClientScript.GetPostBackEventReference(ButtonToTie, "").Replace(":", "$") + ";return false;} else return true;";
            }
            else
            {
                jsString = "if ((event.which && event.which == 13) || (event.keyCode && event.keyCode == 13)) {document." + "forms[0].elements['" + ButtonToTie.UniqueID.Replace(":", "_") + "'].click();return false;} else return true; ";
            }
            // 把 jscript 附加到输入框的onkeydown属性

            if (TextBoxToTie is HtmlControl)
            {
                ((HtmlControl)TextBoxToTie).Attributes.Add("onkeydown", jsString);
            }
            else if (TextBoxToTie is WebControl)
            {
                ((WebControl)TextBoxToTie).Attributes.Add("onkeydown", jsString);
            }
        }
开发者ID:Novthirteen,项目名称:sconit_timesseiko,代码行数:28,代码来源:TieButtonHelper.cs


示例13: AttachToPage

        public void AttachToPage(Page aspnetPage, PageContentToRender contentToRender)
        {
            Verify.ArgumentNotNull(aspnetPage, "aspnetPage");
            Verify.ArgumentNotNull(contentToRender, "contentToRender");

            aspnetPage.Items.Add(PageRenderingJob_Key, contentToRender);

            Guid templateId = contentToRender.Page.TemplateId;
            var rendering = _renderingInfo[templateId];

            if(rendering == null)
            {
                Exception loadingException = _loadingExceptions[templateId];
                if(loadingException != null)
                {
                    throw loadingException;
                }

                Verify.ThrowInvalidOperationException("Failed to get master page by template ID '{0}'. Check for compilation errors".FormatWith(templateId));
            }

            aspnetPage.MasterPageFile = rendering.VirtualPath;
            aspnetPage.PreRender += (e, args) => PageOnPreRender(aspnetPage, contentToRender.Page);

            var master = aspnetPage.Master as MasterPagePageTemplate;
            TemplateDefinitionHelper.BindPlaceholders(master, contentToRender, rendering.PlaceholderProperties, null);
        }
开发者ID:DBailey635,项目名称:C1-CMS,代码行数:27,代码来源:MasterPagePageRenderer.cs


示例14: LoadFileReference

        /// <summary>
        /// Loads a Javascript file reference onto the page
        /// to the file at the given url.
        /// 
        /// The url may be:
        /// 
        ///   1. An absolute url "http://" or "https://"
        ///   2. A tilde url "~/"
        ///   3. A url relative to the given page
        ///   
        /// </summary>
        /// <param name="page">The page on which to load</param>
        /// <param name="url">The url of the file</param>
        public static void LoadFileReference(Page page, string url)
        {
            ClientScriptManager clientscriptmanager = page.ClientScript;
            Type type = page.GetType();

            if (!clientscriptmanager.IsClientScriptBlockRegistered(type, url))
            {
                string pageTildePath =
                    FileTools.GetTildePath(page);

                string resolvedUrl =
                    FileTools.GetResolvedUrl(pageTildePath, url);

                StringBuilder builder = new StringBuilder();

                builder.Append(script_file_1);
                builder.Append(resolvedUrl);
                builder.Append(script_file_2);

                string contents = builder.ToString();

                clientscriptmanager.RegisterClientScriptBlock
                    (type, url, contents, false);
            }
        }
开发者ID:khanman,项目名称:Web-Development-Experiment,代码行数:38,代码来源:Javascript.cs


示例15: UnLockPage

 /// <summary>
 /// 解除锁定页面上的一些组件
 /// </summary>
 /// <param name="page"></param>
 /// <param name="obj">继续保持锁定的控件</param>
 public static void UnLockPage(Page page, object[] obj)
 {
     Control htmlForm = null;
     foreach (Control ctl in page.Controls)
     {
         if (ctl is HtmlForm)
         {
             htmlForm = ctl;
             break;
         }
     }
     //foreach (Control ctl in page.Controls[1].Controls)
     foreach (Control ctl in htmlForm.Controls)
     {
         if (IsContains(obj, ctl) == false)
         {
             //解除锁定
             UnLockControl(page, ctl);
         }
         else
         {
             //锁定
             LockControl(page, ctl);
         }
     }
 }
开发者ID:tiger2soft,项目名称:DotNet.Utilities,代码行数:31,代码来源:PageHelper.cs


示例16: CheckEhrLogin

 public static void CheckEhrLogin(Page objPage)
 {
     if (CookieManager.EhrMemId(objPage)==String.Empty)
     {
         PageTureMgr.TurnEhrLoginPage(objPage, EhrLoginUrl);
     }
 }
开发者ID:neargle,项目名称:ChairoCodes,代码行数:7,代码来源:Session.cs


示例17: FileExists

        private static bool FileExists(Page page, string filePath)
        {
            // remove query string for the file exists check, won't impact the absoluteness, so just do it either way.
            filePath = RemoveQueryString(filePath);

            return IsAbsoluteUrl(filePath) || File.Exists(page.Server.MapPath(filePath));
        }
开发者ID:hungnt-me,项目名称:Dnn.Platform,代码行数:7,代码来源:ClientResourceManager.cs


示例18: imgBtnExportarExcelEjecucion_Click

        protected void imgBtnExportarExcelEjecucion_Click(object sender, ImageClickEventArgs e)
        {
            StringBuilder sb = new StringBuilder();
            StringWriter sw = new StringWriter(sb);
            HtmlTextWriter htw = new HtmlTextWriter(sw);
            Page page = new Page();
            HtmlForm form = new HtmlForm();

            gvIncidenciasBatch.AllowPaging = false;
            gvIncidenciasBatch.DataBind();
            gvIncidenciasBatch.EnableViewState = false;

            page.EnableEventValidation = false;

            page.DesignerInitialize();
            page.Controls.Add(form);
            form.Controls.Add(gvIncidenciasBatch);

            page.RenderControl(htw);

            Response.Clear();
            Response.Buffer = true;
            Response.ContentType = "application/vnd.ms-excel";
            Response.AddHeader("Content-Disposition", "attachment;filename=ReporteIncidenciasBatch" + DateTime.Now.ToShortDateString() + ".xls");
            Response.Charset = "UTF-8";

            Response.ContentEncoding = System.Text.Encoding.Default;

            Response.Write(sb.ToString());
            Response.End();
        }
开发者ID:jlaua,项目名称:WebHomologacion,代码行数:31,代码来源:wfrmDescargarIncidenciasBatch.aspx.cs


示例19: Download2Excel

        /// <summary>
        /// 导出数据到excel
        /// </summary>
        /// <param name="dt">数据表</param>
        /// <param name="page">返回(当前)页</param>
        /// <param name="titlelist">标题列表</param>
        /// <param name="title">文件名称</param>
        public void Download2Excel(DataTable dt, Page page, List<string> titlelist, string filename)
        {
            if (dt.Rows.Count < 1) return;
            var resp = page.Response;
            resp.ContentType = "application/vnd.ms-excel";
            resp.AddHeader("Content-Disposition", string.Format("attachment;filename={0}.xls", filename));
            resp.Clear();

            InitializeWorkbook();

            #region generate data
            ISheet sheet1 = hssfworkbook.CreateSheet("Sheet1");
            var row0=sheet1.CreateRow(0);
            for (int i = 0; i < titlelist.Count; i++)
            {
                row0.CreateCell(i).SetCellValue(titlelist[i]);
            }
            for (int j = 0; j < dt.Rows.Count; j++)
            {
                IRow row = sheet1.CreateRow(j + 1);
                for (int k = 0; k < dt.Columns.Count; k++)
                {
                    row.CreateCell(k).SetCellValue(dt.Rows[j].ItemArray[k].ToString());
                }
            }
            #endregion

            resp.BinaryWrite(WriteToStream().GetBuffer());
            //写缓冲区中的数据到HTTP头文档中
            resp.End();
        }
开发者ID:phiree,项目名称:testttt,代码行数:38,代码来源:ExcelOutput.cs


示例20: WebPartChrome

        public WebPartChrome(WebPartZoneBase zone, WebPartManager manager) {
            if (zone == null) {
                throw new ArgumentNullException("zone");
            }
            _zone = zone;
            _page = zone.Page;
            _designMode = zone.DesignMode;
            _manager = manager;

            if (_designMode) {
                // Consider personalization to be enabled at design-time
                _personalizationEnabled = true;
            }
            else {
                _personalizationEnabled = (manager != null && manager.Personalization.IsModifiable);
            }

            if (manager != null) {
                _personalizationScope = manager.Personalization.Scope;
            }
            else {
                // Consider scope to be shared at design-time
                _personalizationScope = PersonalizationScope.Shared;
            }
        }
开发者ID:nlh774,项目名称:DotNetReferenceSource,代码行数:25,代码来源:WebPartChrome.cs



注:本文中的System.Web.UI.Page类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# UI.Pair类代码示例发布时间:2022-05-26
下一篇:
C# UI.LosFormatter类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap