惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

V
V2EX
V
Vulnerabilities – Threatpost
MongoDB | Blog
MongoDB | Blog
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
P
Proofpoint News Feed
Know Your Adversary
Know Your Adversary
aimingoo的专栏
aimingoo的专栏
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
C
Cisco Blogs
C
CERT Recently Published Vulnerability Notes
T
Tor Project blog
A
Arctic Wolf
L
LangChain Blog
L
LINUX DO - 热门话题
G
Google Developers Blog
Google DeepMind News
Google DeepMind News
T
Threat Research - Cisco Blogs
Stack Overflow Blog
Stack Overflow Blog
I
Intezer
爱范儿
爱范儿
P
Palo Alto Networks Blog
WordPress大学
WordPress大学
H
Hackread – Cybersecurity News, Data Breaches, AI and More
T
The Blog of Author Tim Ferriss
G
GRAHAM CLULEY
S
Securelist
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
Cisco Talos Blog
Cisco Talos Blog
Security Latest
Security Latest
Martin Fowler
Martin Fowler
AWS News Blog
AWS News Blog
L
Lohrmann on Cybersecurity
C
Cybersecurity and Infrastructure Security Agency CISA
酷 壳 – CoolShell
酷 壳 – CoolShell
Recorded Future
Recorded Future
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
C
CXSECURITY Database RSS Feed - CXSecurity.com
Recent Announcements
Recent Announcements
有赞技术团队
有赞技术团队
Apple Machine Learning Research
Apple Machine Learning Research
V2EX - 技术
V2EX - 技术
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
L
LINUX DO - 最新话题
博客园 - Franky
P
Privacy & Cybersecurity Law Blog
Simon Willison's Weblog
Simon Willison's Weblog
W
WeLiveSecurity
Cyberwarzone
Cyberwarzone
The Hacker News
The Hacker News
A
About on SuperTechFans

博客园 - 眼里进了砂

Unity Application Block 1.2 学习笔记 [转] Unity Application Block 與 ASP.NET MVC 學習資源整理 [转] 线程之间的通讯---SynchronizationContext [转] .NET2.0中WinForm自定义的程序配置[转] 使用BackgroundWorker组件进行异步操作编程[转] .NET页面事件执行顺序[转] 不用设置iis .net 实现urlrewrite[转] 利用XPath读取Xml文件 javascript中replace与正则表达式 c# BackgroundWorker组件介绍(属性、方法、事件) .net 2.0 BackgroundWorker类详细用法 .Net的线程同步方法一:ManualResetEvent .NET应用程序中异步调用Web Service的几种方法 come from: veryhappy(wx.net) [转][javascript] Google谷歌首页点点效果 AJAX 中Sys.WebForms.PageRequestManager的事件激发顺序 AJAX 中Sys.Net.WebRequestManager的事件激发顺序 Summary review about Problem.Design.Solution 2 [转发]深入理解 __doPostBack CSS Tips
Summary review about Problem.Design.Solution
眼里进了砂 · 2007-05-30 · via 博客园 - 眼里进了砂

<!-- add on 07/05/30 -->


1.  Avoid using HTML Tables to control layout
     It is highly recommended for developers to use DIVs and separate stylesheet file to define appearance and position instead of using the traditional HTML Table. CSS styles and DIVs provide greater flexibility than tables.
   


2.  Only set the MasterPageFile property in the Page_PreInit event handler to change the MasterPage dynamically
     You can only set the MasterPageFile property in this event handler because the merging of the two pages must happen very early in the page's life cycle, the Load or Init event would be too late.


 

3.  @MasterType directive and the appropriate solution for providing different layouts
     We can use this.Master as a reference to its master page after adding the @MasterType directive
<%@ MasterType VirtualPath="~/MasterPage.master" %> .
     Because we can't dynamically change the master page's type at runtime. For this reason we will not use different master pages to provide different layouts to the user. We can completely change the appearence of the page by applying different styles to it.


 

4.  Specify the Theme and MasterPage
   
To apply a theme to a single page, you use the Theme attribute in the @Page directive:
     <%@ Page Language="C#" Theme="NiceTheme" MasterPageFile="~/MasterPage.master" ... %>     To apply it to all pages, you can set the theme attribute of the <pages> element in web.config, as follows:
     <pages theme="NiceTheme" masterPageFile="~/MasterPage.master" />


 

5.  DIVs properties in CSS Style
     If you don't specify an explicit width and don't use absolute positioning, a DIV will always have an implicit width of 100%.

     #loginbox
   {
      position: absolute;
      top: 16px;
      right: 10px;
      width: 180px;
      height: 80px;

      padding: 2px 2px 2px 2px;
      font-size: 9px;

   }
    
    It uses absolute positioning, its position relys on the top and right property that you specified. 


 

6.  NameSpace, Cache and Server methods in Class files
     You can add a NameSpace into a class files, then in another aspx.cs file, just simply import the namespace and directly use its methods.
     We can use such as Cache.add and Server.MapPath in an ordinary aspx.cs page. However, we have to use the HttpContext.Current.Cache and HttpContext.Current.Server.MapPath methods in a seperate cs class.
     CacheDependency can be used to cache some information until the dependent item changes.

     CacheDependency dep = new CacheDependency(themesDirPath);
     HttpContext.Current.Cache.Insert("SiteThemes", themes, dep);
     In this case, the cache 'SiteThemes' will be kept until the dependency themesDirPath changes.
 

7.  File Operation
     To operate the folders, use the Directory.GetDirectories(themeDirPath) and Path.GetFileName(xxx[i]) to retrive the folders entire physical path or the folder name.

     To manipulate the files, use the Directory.GetFile(themeDirPath) and FileInfo class to retrieve the file information such as file name, update time and so on. 


 

8.  Control.UniqueID
     We can use the Control.UniqueID to retrive the rendered control's ID even though this control is embeded in a Component such as User Control. i.e, ctl00_LoginView1_Login_UserName.


 

9.  Customize BasePage class and __EVENTTARGET
     To implement some special events in particular page, we need to customize a BasePage class, inheriting from the System.Web.UI.Page and overriding some base's events such as OnPreInit and


OnLoad events. After that, inherit this customized BasePage class in every aspx.cs page to inplement the events you specified in the BasePage class.
     We can use this.Request.Form["__EVENTTARGET"] to retrieve the ID of Control that triggerd the postback event except the Button Control and ImageButton Control (We can use another approach to check this two kinds of Controls, refer to an article posted previously)