Programming Microsoft ASP.NET 4 - Dino Esposito [447]
The ScriptManager control takes on this burden and, based on the aforementioned naming convention, distinguishes between debug and release scripts. The ScriptManager control picks debug scripts when the debug attribute of the Script Globalization When the EnableScriptGlobalization property is true, the ScriptManager emits proper script code that sets up a client-side global Sys.CultureInfo object that JavaScript classes can consume to display their contents in a culture-based way. Only a few methods and a few JavaScript objects support globalization. In particular, it will work for the localeFormat method of Date, String, and Number types. Custom JavaScript classes, though, can be made global by simply calling into these methods or accepting a Sys.CultureInfo object in their signatures. The UpdatePanel Control You might wonder how partial rendering differs from classic postbacks. The difference is in how the postback is implemented—instead of letting the browser perform a full-page refresh, the UpdatePanel control intercepts any postback requests and sends an out-of-band request for fresh markup to the same page URL. Next, it updates the DOM tree when the response is ready. Let’s investigate the programming interface of the control. The UpdatePanel Control at a Glance The UpdatePanel control derives directly from Control, meaning that it acts as a mere Ajax-aware container of child controls. It provides no user-interface-related facilities. Any required styling and formatting should be provided through the child controls. In contrast, the control sports a number of properties to control page updates and also exposes a client-side object model. Consider the following classic ASP.NET code: AllowPaging="True" AutoGenerateColumns="False"> SelectMethod="LoadAll" /> This code causes a postback each time you click to view a new page, edit a record, or sort by a column. As a result, the entire page is redrawn even
Globalization is a programming feature that refers to the code’s ability to support multiple cultures. A request processed on the server has a number of ways to get and set the current culture settings. For example, you can use the Culture attribute on the @Page directive, the Culture property on the Page class, or perhaps the
Partial rendering is the programming technique centered on the UpdatePanel control. In ASP.NET, the UpdatePanel control represents the shortest path to Ajax. It allows you to add effective Ajax capabilities to sites written according to the classic programming model of ASP.NET Web Forms. As a developer, you have no new skills to learn, except the syntax and semantics of the UpdatePanel control. The impact on existing pages is very limited, and the exposure to JavaScript is very limited—even null in most common situations.
The UpdatePanel control is a container control defined in the System.Web.Extensions assembly. It belongs specifically to the System.Web.UI namespace. Although it’s logically similar to the classic ASP.NET Panel control, the UpdatePanel control differs from the classic panel control in a number of respects. In particular, it doesn’t derive from Panel and, subsequently, it doesn’t feature the same set of capabilities as ASP.NET panels, such as scrolling, styling, wrapping, and content management.