CSS Ellipsis
.TextEllipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap;}
让一个盛Text的容器中的文字不折行,而显示 ...
proven and usable hacks and experience of Internet application development, for my own use.
.TextEllipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap;}
让一个盛Text的容器中的文字不折行,而显示 ...
Posted by Dillone Hailei Wang 王海磊 at 2/05/2007 05:57:00 PM
Labels: CSS
Asynchronous programming allows a process to have multiple threads, enabling the process to do more than one action simultaneously. While asynchronous programmingcan be complicated, it can dramatically improve performance in situations where the process would otherwise need to wait for a relatively slow action, such as accessing a network resource, to occur.
For example, if you are creating a Web page that must query a network resource (such as a Web service), IIS and ASP.NET can only render a limited number of pages simultaneously.Therefore, the thread pool can become completely consumed, creating a performance bottleneck. Once the thread pool is consumed, your server waits for pages to finish rendering before beginning to process other pages. Even though the server might have available processor cycles, requests are queued. By enabling asynchronousWeb page programming, the server can begin rendering more pages simultaneously,improving efficiency and reducing page rendering time.
Posted by Dillone Hailei Wang 王海磊 at 12/27/2006 02:22:00 PM
Labels: ASP.NET, Programming
我很喜欢ASP.NET 2.0中的以DataSet为核心的DAL,它提供了DataSet, DataTables, TableAdapters等等对于数据库的完美模拟。我可以使用VS2005提供的DataSet Designer, Wizard等工具完成创建和配置DAL的工作。
ObjectDataSource与DAL的结合,把这个方便延伸到了UIP层和UI层。我现在要考虑的是,是否给每一个用到ObjectDataSource的server control提供一个自己用的ODS,还是共用。
Posted by Dillone Hailei Wang 王海磊 at 12/27/2006 11:42:00 AM
Labels: Architecture, ASP.NET, Data Access Layer, DataSet
1, All the places having XSS vulnerabilities (relating to text), the controls should have a properties that like the Literal contrl's Mode property to check tis vulnerabilities.
Sercurity Alerst:
Be sure to HTML encode all data using either the Server.HtmlEncode or the HttpUtility.HtmlEncode method.
Posted by Dillone Hailei Wang 王海磊 at 12/21/2006 04:27:00 PM
The best use for the Literal control is in scenarios where you want to render text and controls directly into a page without any additional markup.
The Literal control contains the Mode property, which is used to specify particular handling of the content of the Text property:
Mode : Description
PassThrough : The Text content is rendered as is.
Encode : The Text content is HTML-encoded.
Transform : The Text content is converted to match the markup languageof the requesting browser, such as HTML, XHTML, WML, or cHTML. If the markup language is HTML or XHTML, the content is passed through to the browser.
Security Alert:
By default, populating the Literal control with data from untrusted sources can create Cross Site Scripting (XSS) vulnerabilities. Set the Mode property to Encode to provide HTML encoding of untrusted data that will be placed into the Text property.
Posted by Dillone Hailei Wang 王海磊 at 12/21/2006 04:19:00 PM
Labels: ASP.NET, Hack, Server Control
Posted by Dillone Hailei Wang 王海磊 at 12/21/2006 03:34:00 PM
DataSet Designer
Posted by Dillone Hailei Wang 王海磊 at 12/20/2006 11:07:00 AM
Repeater应该不算是和DataGrid和DataList一路的,只不过看上去有一点像而已。
DataGrid/GridView主要是用来显示数据库报表类的数据的,或者说就是用来显示报表的。
DataList(我认为应该叫做ListView)可以用来显示“格子中自有天地”的数据。比如Blog的comments就可以用DataList来做。
A Brief Overview of the DataGrid Web Control
One downside of a DataGrid is its rather "blocky" display. That is, the DataGrid displays each Despite its limitations on specifying the display of the DataGrid's data, the DataGrid is the most commonly used data Web control due to its impressive feature list. A Brief Overview of the DataList Web Control Views: As the code example above shows, DataLists are comprised of a number of templates. Templates can contain a mix of HTML syntax and databinding expressions, as shown in the above ItemTemplate. Databinding expressions are ones delimited by The DataList is capable of performing sorting, paging, and editing of its data, but to do so requires quite a bit more programming than to accomplish these tasks with the DataGrid. Therefore, if you know you will be needing these functionalities, it is likely best to proceed with the DataGrid. If, however, you will not need these functionalities, but do necessarily need the extra control over the formatting, consider a DataList. A Brief Overview of the Repeater Control The Repeater, like the DataList, only supports templates; however, the Repeater has only a subset of the DataList's template options. Specifically, the following templates can be used with the Repeater: The Repeater control provides the maximum amount of flexibility over the HTML produced. Whereas the DataGrid wraps the Therefore, the Repeater is a good data Web control choice if you want to display data in, say, an unordered list. As the following code and live demo show, displaying database data in an unordered list using a Repeater is relatively straightforward. All you have to do is add the The Repeater is a good choice if you need to display your data in a format different than an HTML Conclusion This article examined the similarities and differences of the three data Web controls: the DataGrid, DataList, and Repeater. The main similarities between these three controls is in how they iterate through their Each of the data Web controls has its own strengths and weaknesses. The DataGrid, for example, is great for quickly and easily displaying database data in an HTML The DataList allows for more freedom. For example, in an earlier live demo we saw that using the DataList's The Repeater allows for the utmost flexibility in its output, since the only HTML rendered from a Repeater is the HTML generated in its templates. That is, no additional HTML output is generated, as is the case with both the DataGrid and DataList. The Repeater, however, does not have any built-in support for sorting, paging, or editing of its data.
Posted by
Dillone Hailei Wang 王海磊
at
12/19/2006 04:22:00 PM
Scenario : 判断给定的某年某月有多少天
Posted by
Dillone Hailei Wang 王海磊
at
12/19/2006 03:29:00 PM
Labels:
Date,
Hack,
JavaScript
ASP.NET includes controls and classes to simplify the process of adding login capabilities to your Web application.
Posted by
Dillone Hailei Wang 王海磊
at
12/18/2006 03:21:00 PM
Labels:
ASP.NET,
Authentication,
Authorization,
Server Control
Introduction ASP.NET AJAX Architecture ASP.NET AJAX consists of client-script libraries and of server components that are integrated to provide a robust development framework. In addition to ASP.NET AJAX, you can use the ASP.NET AJAX Control Toolkit and the community-supported features in the ASP.NET AJAX Futures releases. ASP.NET AJAX Server Components The ASP.NET AJAX server components consist of ASP.NET controls and components to manage the UI and flow of an application, and to manage serialization, validation, control extensibility, and so on. There are also ASP.NET Web services that enable you to access ASP.NET application services for forms authentication and user profiles. ASP.NET AJAX Server Controls The ASP.NET AJAX server controls consist of server and client code that integrate to produce AJAX-like behavior. The following list describes the most frequently used ASP.NET AJAX server controls. ASP.NET AJAX Web Services ASP.NET AJAX exposes ASP.NET application services for forms authentication and user profiles to client script by using Web services. This enables you to help protect resources by using forms authentication and to persist user-specific settings on the server by using client script. In addition, ASP.NET AJAX includes network components that make it easy to return results from any Web service call. ASP.NET AJAX Server Control Extensibility ASP.NET AJAX enables you to create custom ASP.NET AJAX server controls that include client behaviors. For information and examples, see the ASP.NET AJAX Extensibility tutorials and the Microsoft ASP.NET AJAX Control Toolkit. ASP.NET AJAX Client Components The ASP.NET AJAX client-script libraries consist of JavaScript (.js) files that provide features for object-oriented development. This has not been previously available to JavaScript developers. The object-oriented features included in the ASP.NET AJAX client-script libraries enable a new level of consistency and modularity in client scripting. The following layers are included in the ASP.NET AJAX script libraries: ASP.NET AJAX Control Toolkit The ASP.NET AJAX Control Toolkit is a collection of samples and components that show you some of the experiences you can create with rich client ASP.NET AJAX controls and extenders. The Control Toolkit provides both samples and a powerful SDK to simplify creating and reusing your custom controls and extenders. ASP.NET AJAX Community-supported Futures Releases The ASP.NET AJAX community-supported Futures releases provide features that extend the core ASP.NET AJAX platform with functionality that remains under development and is not included in the Microsoft ASP.NET AJAX release. This includes additional extender controls, support for client declarative syntax (xml-script), and more.
Posted by
Dillone Hailei Wang 王海磊
at
12/16/2006 08:50:00 PM
Introduction Partial-Page Rendering Features Partial-page rendering relies on server controls in ASP.NET 2.0 AJAX Extensions and on client functions in the Microsoft AJAX Library. You do not have to use the Microsoft AJAX Library to enable partial-page rendering, because this functionality is provided automatically when you use the ASP.NET 2.0 AJAX Extensions server controls. Server Controls for Partial-Page Updates To add AJAX functionality to ASP.NET Web pages, you identify individual sections of the page that you want to update. You then put the content of these sections into UpdatePanel controls. The contents of an UpdatePanel control can be HTML or other ASP.NET controls. You can add an UpdatePanel control to the page as you would any other control. By default, postbacks originating from controls inside the update panel (child controls) automatically initiate asynchronous postbacks and cause a partial-page update. You can also specify that controls outside the UpdatePanel cause an asynchronous postback and that they refresh the UpdatePanel control's content. A control that causes an asynchronous postback is referred to as a trigger. An asynchronous postback behaves much like a synchronous postback. All the server page life-cycle events occur and view state and form data are preserved. However, in the rendering phase, only the contents of theUpdatePanel control are sent to the browser. The rest of the page remains unchanged. To support partial-page rendering, you must put a ScriptManager control on the page. Enabling Partial-Page Rendering Support You enable or disable partial-page rendering for a page by setting the EnablePartialRendering property of the ScriptManager control. If partial-page rendering is not enabled for a page, if it has been disabled, or if it is not supported in a browser, the page uses fallback behavior. Actions that ordinarily would perform an asynchronous postback instead perform a synchronous postback and update the whole page. Any UpdatePanel controls on the page are ignored, and their contents are rendered as if they were not inside an UpdatePanel control.
Posted by
Dillone Hailei Wang 王海磊
at
12/16/2006 08:24:00 PM
Labels:
AJAX,
ASP.NET,
Server Control
A control adapter is an optional class that, if present and properly configured, is used to render the Web control instead of using the control's default rendering logic. In short, using control adapters you can take the core functionality of a Web control, but completely customize the markup emitted.
Posted by
Dillone Hailei Wang 王海磊
at
12/05/2006 07:49:00 PM
Labels:
ASP.NET,
CSS,
Server Control
d Windows authentication is used together with IIS authentication. When IIS authentication is complete, ASP.NET uses the authenticated identitiy to authorize access.
Posted by
Dillone Hailei Wang 王海磊
at
10/30/2006 04:08:00 PM
d When your code is excuted by IIS, it executes under the context of ASP.NET Worker Process user account (ASP.NET) , therefore, your application may be restricted by that account's security rights.
Posted by
Dillone Hailei Wang 王海磊
at
10/30/2006 02:53:00 PM
Labels:
ASP.NET,
Class Library,
IO
d Someone said: Directory is a static class, while DirectoryInfo can be instantiated. Basically, both work the same.
Posted by
Dillone Hailei Wang 王海磊
at
10/30/2006 01:16:00 AM
Labels:
.NET Framework,
Class Library,
IO
Posted by
Dillone Hailei Wang 王海磊
at
10/30/2006 12:57:00 AM
Labels:
.NET Framework,
Class Library,
Hack,
IO
e .NET Framework Class Library CheckBoxList Members
Posted by
Dillone Hailei Wang 王海磊
at
10/26/2006 02:40:00 PM
Labels:
ASP.NET,
Hack,
Server Control
e 4GuysFromRolla Little Known, Invaluable Methods and Properties in the .NET Framework Base Class Library
Posted by
Dillone Hailei Wang 王海磊
at
10/25/2006 03:04:00 PM
Labels:
.NET Framework,
Class Library,
IO
^ 我想尽量兼顾VB.NET和C#。
Posted by
Dillone Hailei Wang 王海磊
at
10/24/2006 04:24:00 PM
Labels:
.NET Framework,
Naming Convention,
Programming
There are and will be many and many AJAX controls, some of them are the essentials and the mostly used. 主要是关于Panel的“基层”control,我称之为“Panel Group”吧。Thus, learn to use them in the first wave: d UpdatePanel 这个是最基本的。专门研究吧。 d PopupControl d HoverMenu d CollapsiblePanel d Accordion d DynamicPopulate
Posted by
Dillone Hailei Wang 王海磊
at
10/23/2006 11:45:00 PM
Labels:
AJAX,
ASP.NET,
Control Toolkit
Posted by
Dillone Hailei Wang 王海磊
at
10/23/2006 01:36:00 PM
Labels:
AJAX,
ASP.NET,
Server Control
非常高兴Microsoft ASP.NET AJAX 1.0 Beta终于发布了。虽然此前基于Altas写了不少代码,我还是很愿意告别Prince Atlas,修改到新的ASP.NET AJAX上来。
Posted by
Dillone Hailei Wang 王海磊
at
10/23/2006 10:31:00 AM
^ What is Interoperation for?
Posted by
Dillone Hailei Wang 王海磊
at
10/22/2006 03:20:00 PM
Labels:
.NET Framework,
Class Library,
Hack,
Interoperation
Posted by
Dillone Hailei Wang 王海磊
at
10/22/2006 02:59:00 PM
Labels:
.NET Framework,
Class Library,
Language
The DataGrid Web control was designed to display data in an HTML . Each row in the DataGrid's
DataSource
is displayed as a row in the HTML . The DataGrid has an
AutoGenerateColumns
property, which can be set to either True or False. If AutoGenerateColumns
is set to True (the default), each field in the DataSource
is displayed as a column in the resulting HTML . If, however,
AutoGenerateColumns
is set to False, then the developer must explicitly specify what columns should appear. DataSource
record as a row in an HTML , and each field as a column in said table. While the DataGrid allows for the developer to customize the output for a particular column through the
, it still is restrictive in that each DataSource
record occupies precisely one HTML row.
The DataList Web control is useful for displaying data that can be highly customized in its layout. By default, the DataList displays its data in an HTML . However, unlike the DataGrid, with the DataList you can specify via the
RepeatColumns
how many DataSource
records should appear per HTML row.
[View a Live Demo!]
<%# DataBinder.Eval(Container.DataItem, "Description") %>
<%# DataBinder.Eval(Container.DataItem, "ViewCount", "{0:#,###}") %> <%#
and %>
, and contain code that's executed when the DataListItem's DataBind()
method is called. The ItemTemplate specifies the template used for each record in the DataSource
. The DataList contains other templates, which are listed below:
DataSource
uses this template instead of the ItemTemplate. ShowHeader
property is set to True. ShowFooter
property is set to True.
The Repeater control, unlike the DataGrid and DataList, is not derived from the WebControl
class, and therefore does not have the stylistic properties that are common to all Web controls. (These stylistic properties that are common to all Web controls include Font
, ForeColor
, BackColor
, BorderStyle
, and so on.)
DataSource
contents in an HTML , and the DataList wraps the contents in either an HTML
or
tags , the Repeater adds absolutely no HTML content other than what you explicitly specify in the templates.
tag to the HeaderTemplate, the tag to the FooterTemplate, and an
tag along with the
DataSource
field you want to display to the ItemTemplate:
[View a Live Demo!]
. Unfortunately, the Repeater does not provide any built-in means for editing, sorting, or paging of data. However, these mechanisms could be added programmatically, but would result in a lot of code and effort.
DataSource
, building up a collection of DataWebControlNameItems. Furthermore, the three Web controls all share three events: ItemCreated
, ItemDataBound
, and ItemCommand
. , and allows for advanced features such as paging, sorting, and in-place editing to be added with little to no programming. However, the DataGrid is quite limited in the general format with which the data is presented.
RepeatColumns
property, multiple DataSource
records could be displayed in a single HTML row. Additionally, the DataList's content is specified via templates, which allows for a high degree of customization.
Determining the Number of Days in a Month with Javascript
Essentially, writing some code to determine the number of days in a given month of a given year with javascript is not the worlds most difficult task. The solution normally involves determining if the month is February, an month with 30 days or a month with 31 days, then (if February) checking if the year is a leap year. All these tests add up, however, and add several lines of code to your .js file.
They are unnecessary! Apparently, the javascript Date function allows you to overflow the day number parameter that you pass, creating a date in the next month. Deliberately overflowing the day parameter and checking how far the resulting date overlaps into the next month is a quick way to tell how many days there were in the queried month. Here is a function that does this:
function daysInMonth(iMonth, iYear) {
return 32 - new Date(iYear, iMonth, 32).getDate();
}
iMonth is zero based, so 0 represents January, 1 represents February, 2 represents March and 11 represents December.
iYear is not zero based, this is the actual calendar year number. (2006 is actually 2006)
Pray that the browser developers know the correct way to determine whether a year is a leap year! (It's more complicated than a simple mod 4 == 0) Here is a quote from Wikipedia's page on leap years: "The Gregorian calendar, the current standard calendar in most of the world, adds a 29th day to February in all years evenly divisible by 4, except for centennial years (those ending in '00'), which receive the extra day only if they are evenly divisible by 400. Thus 1600, 2000 and 2400 are leap years but 1700, 1800, 1900 and 2100 are not."
Monday, December 18, 2006
Login in ASP.NET
The login controls include:
A user interface that prompts for user names and passwords and (Remember me 记住我) enables users to select whether they want to be automatically authenticated the next time they visit.
You can use the Login control with ASP.NET membership without writing any code, or you can write your own authentication code by adding a handler for the Authenticate event.
Displays a login link for users who haven’t been authenticated and a logout link for users who are currently logged in.
Displays the current user’s user name, if logged in.
Enables you to display different information to users who are logged in.
For example, you could use this link to go to site features that are available only to authenticated users.
Enables password retrieval for a user by sending an e-mail message to the user or by having the user answer a security question.
Enables a user who is logged in to change his or her password.
Gathers information from a new user and creates a new account. Saturday, December 16, 2006
ASP.NET AJAX Overview
Microsoft ASP.NET AJAX enables you to quickly create Web pages that include a rich user experience with responsive and familiar user interface (UI) elements. ASP.NET AJAX provides client-script libraries that incorporate cross-browser ECMAScript (JavaScript) and dynamic HTML (DHTML) technologies, and it integrates them with the ASP.NET 2.0 server-based development platform. Using ASP.NET AJAX, you can improve both the user experience and the efficiency of your Web applications.
Why Use ASP.NET AJAX?
ASP.NET AJAX enables you to build rich Web applications that have many advantages over Web applications that are completely server-based. ASP.NET AJAX applications offer:
Manages script resources for client components, partial-page rendering, localization, globalization, and custom user scripts. The ScriptManager control is required in order to use the UpdatePanel, UpdateProgress, and Timer controls.
Enables you to refresh selected parts of the page instead of refreshing the whole page by using a synchronous postback.
Provides status information about partial-page updates in UpdatePanel controls.
Performs postbacks at defined intervals. You can use the Timer control to post the whole page, or together with the UpdatePanel control to perform partial-page updates at a defined interval.
For information and examples, see Asynchronous Communication Layer Overview and ASP.NET Application Services Tutorials.
This provides compatibility across the most frequently used browsers (including Microsoft Internet Explorer, Mozilla Firefox, and Apple Safari) for your ASP.NET AJAX scripts.
which include extensions to JavaScript, such as classes, namespaces, event handling, inheritance, data types, and object serialization.
which includes components such as string builders and extended error handling.
that handles communication with Web-based services and applications, and that manages asynchronous remote method calls.
ASP.NET AJAX Partial-Page Rendering Overview
Partial-page rendering removes the need for the whole page to be refreshed as the result of a postback. Instead, only individual regions of the page that have changed are updated. As a result, users do not see the whole page reload with every postback, which makes user interaction with the Web page more seamless. Microsoft ASP.NET 2.0 AJAX Extensions enables you to add partial-page rendering to new or existing ASP.NET Web pages without writing client script.
Scenarios
ASP.NET 2.0 AJAX Extensions enables you to extend existing ASP.NET 2.0 applications and develop new ones that incorporate AJAX (Asynchronous JavaScript and XML) functionality. Use ASP.NET 2.0 AJAX Extensions when you want to do the following:
The primary features of Microsoft ASP.NET AJAX partial-page rendering include the following:
The ScriptManager control:
You can also specify whether partial-page rendering is supported for a page by setting the SupportsPartialRendering property of the ScriptManager control.
If you do not set the SupportsPartialRendering property and if the EnablePartialRendering property is true (which is the default), the capabilities of the browser are used to determine whether partial-rendering is supported.Tuesday, December 05, 2006
Notes on ASP.NET 2.0 CSS Friendly Control Adapter
This set of free control adapters, released by Microsoft, provide a set of control adapters that render a variety of built-in ASP.NET controls using preferred CSS techniques.
Moreover, the CSS control adapters ignore any control-level style settings that would get rendered as inline style elements in the rendered markup and instead require that style information be separated out and specified via CSS classes.
While these could be created from scratch, Microsoft has provided the ASP.NET 2.0 CSS Friendly Control Adapters that can be downloaded and plugged into your ASP.NET web applications with minimal effort. Once installed, the control adapters will no longer render inline style attributes (you need to use CSS classes) and replaces the layouts of the Menu, TreeView, and other controls with CSS techniques.
The presentation settings for these classes can be specified in the page's style element or, ideally, in a separate CSS file.
Indeed, you can modify any ASP.NET control so it produces exactly the HTML you want.
I think Microsoft will build the CSS features into ASP.NET 3.0 as an essence. We won't use inline style anymore, neither table tags for layout, at least I won't. :-)
Actually, I really do not care about what kind of code is beneith the screen/page, I only require it works well as I and users expected. CSS or inline style, table or div, I don't give a fuck. As we get the better one freely and effortlessly, why not better. ;-) That's it.Monday, October 30, 2006
ASP.NET and IIS security
d In a Windows-based authentication model, the requests go directly to IIS to provide the authentication process. IIS first takes the user's credentials from the domain login. If this process fails, IIS desplays a pop-up dialog box so the user can enter his login information.
d Windows authenticaton is quite uesful in an intranet environment where you can let the server deal completely with the authentication process, especially in environments where users are already logged onto a network.
Dealing with IO in ASP.NET envirenment
d By deafult, the ASP.NET Worker Process does not have rights to write to the local disk.
^ What the ASP.NET Worker Process is allowed to do inside of the IO namespace?
Directory V.S. DirectoryInfo
d The Directory class exposes static methods you can use to create, move, and delete directories. The DirectoryInfo represents a specific directory and lets you perform many of the same actions as the Directory class on the specific directory. Additionally, it enumerates child directoreis and files.
Copying files and directories in .NET
Thursday, October 26, 2006
Using CheckBoxList in ASP.NET
Wednesday, October 25, 2006
Working with File Paths in .NET
Tuesday, October 24, 2006
My Naming Conventions in .NET
^ Field/Class Variable: Pascal Case。Always indicate Private, do not use Dim.
^ Property: Pascal Case。
^ Parameter: Camel Case。在method body中,定义一个Local Variable,采用Pascal Case命名,除了首字母其他完全一致,然后把parameter赋值给相应的Local Variable。
^ Property和Method是给“外人”看的,命名要“好看”,所以就要规规矩矩地Pascal Case。Field是自己用的,所以命名可以有点儿“特色”。
d Field: Camel Case with Leading Underscore. In VB.NET, always indicate "Protected" or "Private", do not use "Dim".
Of all the items here, the leading underscore is really the only controversial one. I personally prefer it over straight underscore-less camel case for my private variables so that I don't have to qualify variable names with "this." to distinguish from parameters in constructors or elsewhere where I likely will have a naming collision. With VB.NET's case insensitivity, this is even more important as your accessor properties will usually have the same name as your private member variables except for the underscore.
d Properties: Pascal Case, no underscores. Try to avoid abbreviations. Members must differ by more than case to be usable from case-insensitive languages like Visual Basic .NET.
VB: Public Property RecordID As Integer
C#: public int RecordID
d Parameters: Camel Case. Try to avoid abbreviations. Parameters must differ by more than case to be usable from case-insensitive languages like Visual Basic .NET.
VB: ByRef recordID As Integer
C#: ref int recordID
d What are your thoughts on naming conventions that need to be used to distinguish the class variables, function local variables and method arguments?
d By class variables, I assume you mean fields. Those should be private (use properties for public exposure to provide a level of abstraction). For function locals, those are by definition private. For method arguments, those need to be camelCased. For the privates, I have seen two patterns in the .NET Framework: one is leading underscore, and the other is this.Foo. Either works for me.
d However, I then had to do some VB.NET development and the language isn't case sensitive. I've seen some examples that add a "Field" suffix in VB.NET . I think that is worse than a leading "_". So I came full circle and started using "_" again. :)
e Designing .NET Class Libraries: Naming Conventions (January 26, 2005)
e .NET Programming Standards and Naming ConventionsMonday, October 23, 2006
The 1st wave of Microsoft ASP.NET AJAX Control to master
PopupControl is an ASP.NET AJAX extender that can be attached to any control in order to open a popup window that displays additional content.
This popup window will probably be interactive and will probably be within an ASP.NET AJAX UpdatePanel, so it will be able to perform complex server-based processing (including postbacks) without affecting the rest of the page.
The popup window can contain any content, including ASP.NET server controls, HTML elements, etc..
Once the work of the popup window is done, a simple server-side call dismisses it and triggers any relevant script on the client to run and update the page dynamically.
^ 这是个基本的control,也是比较原始意义的AJAX功能,用途比较广泛。比如填写某个TextBox的时候,可以探出一个小Panel用于选择日期,计算某些数等等。
HoverMenu is an ASP.NET AJAX extender that can be attached to any ASP.NET WebControl, and will associate that control with a popup panel to display additional content.
^ 我觉得HoverMenu这个名字起得不好,不如叫HoverPopupPanel。这种功能倒是会用得挺多,比如用于当鼠标滑到某个位置的时候,弹出一个圆角小方框显示文字。
The CollapsiblePanel is a very flexible extender that allows you to easily add Collapsible sections to your web page. This extender targets any ASP.NET Panel control.
The page developer specifies which control(s) on the page should be the open/close controller for the panel, or the panel can be set to automatically expand and/or collapse when the mouse cursor moves in or out of it, respectively.
The Accordion is a web control that allows you to provide multiple panes and display them one at a time. It is like having several CollapsiblePanels where only one can be expanded at a time.
The Accordion is implemented as a web control that contains AccordionPane web controls. Each AccordionPane control has a template for its Header and its Content. We keep track of the selected pane so it stays visible across postbacks.
DynamicPopulate is a simple extender that replaces the contents of a control with the result of a web service or page method call. The method call returns a string of HTML that is inserted as the children of the target element.
^ 这应该最原始意义上的AJAX功能。
Using the UpdatePanel Control
Microsoft ASP.NET AJAX 1.0 Beta Just Released!
我认为,AJAX虽然目前看来似乎是一种新技术,有一点独立性,但最终而且不久就会完全融合进ASP.NET中,成为ASP.NET 3.0,的基本属性。我们不会再特意安装AJAX包,也不需要在aspx文件中特别声明什么,因为它已经是ASP.NET的native and default features。在开发中使用AJAX feature,我们也不会看到很特殊的AJAX的标签,因为提供AJAX功能的标签都会统一在asp下。
其实,在目前的ASP.NET 2.0中,我们就已经能够看到一些默认的AJAX feature了。比如GridView中的sorting,paging等feature。而且会在ASP.NET页面的Page命令中找到一个叫Async的attribute,这就是用来启动Asyncronous功能的。
在未来的版本(ASP.NET 3.0)中,我预计AJAX相关的功能和feature会被统一规划,完全融合进ASP.NET的血液中,消失得无影踪。你将不再能找到AJAX,你只会看到被注入新的血液的ASP.NET。
我非常喜欢Microsoft ASP.NET AJAX的另一个原因是其使用方式。不像Ruby on Rails那样需要在RHTML中写很多看起来有些奇怪的代码,也不需要像Google Web Toolkit那些通过写Java代码来获得AJAX功能。在Microsoft ASP.NET AJAX中,我们只需要通过写标签的方式通过Server Control来实现出色的AJAX功能。也就是通过Declarative Programming的方式来快速地实现AJAX,就如同使用普通的ASP.NET Server Control一样。当然,这个问题实质上是关于Declarative Programming和Imperetive Programming两种开发流派孰优何优。
总之,对于使用过Ruby on Rails,Google Web Toolkit和Microsoft ASP.NET AJAX的我来说,我更喜欢Microsoft ASP.NET AJAX,因为它符合我对Declarative Programming的倾向性以及我对productivity(高生产效率)的强烈需求。Sunday, October 22, 2006
Using unmanaged code
There might be many lines of legacy code left for companies. If they had to rewrite and retest thiese codes prior to launching any new application developed in .NET, they would have never made the switch. Using an "all or nothing" approach with migrating to .NET is simply too expensive and time consuming for many companies with investments in legacy code.
By taking advantage of Interoperation, they are able to migrate their existing applications little by little, in a manner that was virtually transparent to clients. Were it not for Interoperation, they would have never made the migration.
^ Prior to advent of the .NET Framework, the COM Framework was the primary framework for developers to interact with the Windows operating system.
d The mechanism that serves as proxy so that the .NET runtime can communicate with a COM component is known as a Runtime Callable Wrapper (RCW), which handles the majority of the work between .NET and COM for you, including marshaling data types, handling events, and handling interfaces.
d Unlike pure .NET components, COM components must be registered before they can be used.
d Every COM components must have an entry in the Windows registry.
d After importing it, using an object contained in a given COM library is virtually identical to using ne created purely in .NET.
d What is Platform Invoke? and when to use it?
d Use Platform Invoke through the System.Runtime.InteropServices namespace:Imports System.Runtime.InteropServices
Public Class InterExample
Private Shared Function GetForeWindow() As IntPtr
End Function
Public Shared Sub GetScreenDemo()
Dim DemoHandle = GetForeWindow()
End Sub
End Classd Encapsulating DLL Functions: Because Platform Invoke calls is not elegant, it's often beneficial to create a class that exposes them and wraps this functionality. After all, much of the .NET Framework is composed of precisely this methodology.
@ You need to call an unmanaged function from your managed code by using Platform Invoke services. What should you do?
Create a class to hold DLL functions and then create prototype methods by using managed code.
StringBuilder V.S. String
Labels
Archive
Feed
About Me
View my complete profile
Websites of mine
Websites I like
Quotes
Advertisement