1. Original Entry + Comments2. Write a Comment3. Preview Comment


January 17, 2005  |  Control changes for Whidbey  |  9251 hit(s)

Back to ASP.NET and Whidbey for a change. In this post I list changes to so-called standard controls. (Thusly named, reasonably enough, because they appear on the Standard tab in the Toolbox in Visual Studio Whidbey.) I won't vouch for the perfect completeness of this list. If you spot mistakes or ommissions, leave a comment and I'll fix it.

General
The base controls class(es) have been updated so that all controls support the following features:
  • Theming. You can create a theme, which is a set of properties to define a set of colors, fonts, etc. for controls. (Gross simplification.) You can then apply the theme to an individual control, a page, or a Web site.
  • A new ValidationGroup property allows you to create discrete sets of controls on the page that are validated (or not validated) together. This simplifies conditional validation.

Data Binding
The new data binding model is built on data source controls (SqlDataSource, AccessDataSource, ObjectDataSource, XmlDataSource, SiteMapDataSource). The data source controls abstract the mechanics of fetching data so that other controls can bind to them interchangeably. The data source control takes care of connecting, querying, and caching data. No explicit binding code is required.

A new property AppendDataBoundItems is defined for list controls (CheckBoxList, ListBox, etc). If this property is set to true, data binding adds to statically defined items, if any, rather then overwriting them.



AdRotator
Allows you to create popup and pop-under ads in addition to the banner ads from days of yore. Feature cut.
Supports new data-binding model based on data source controls. (Requires a specific schema).
Ads can be added dynamically to cached pages (aka "post-cache substitution" -- see also Substitution control below). [Update 22 Jan 05] Nikhil just posted an extensive discussion of post-cache substitution.

Button
New property OnClientClick takes as string the name of a client-side method to invoke after the button is clicked but before postback occurs. In client script you can cancel the postback.
New property PostBackUrl takes a URL -- page will be cross-posted to that page.
New property UseSubmitBehavior causes the button to emit JavaScript to perform post. (Like LinkButton controls.)

BulletedList (new)
Like other list controls (e.g. CheckBoxList), but renders a bulleted list. Allows you to set bullet style (plain text, hyperlinks, LinkButton controls, graphics). Data bindable just like other list controls.

Calendar
New Caption property renders a caption element in the table.
New UseAccessibleHeader renders day names in <th> tags.
The DayRenderEventArgs object supports a new property SelectUrl. This returns the JavaScript that is normally used by the Calendar's LinkButton days. You can use it to customize the day link, like this:
Protected Sub Calendar1_DayRender(ByVal sender As Object, _
ByVal e As DayRenderEventArgs) _
Handles Calendar1.DayRender
If e.Day.Date = New DateTime(2004, 12, 25) Then
Dim dayContents As String = _
"<a href=""" & e.SelectUrl & """>" & "Xmas" & "</a>"
e.Cell.Text = dayContents
End If
End Sub
Checkbox
New properties LabelAttributes and ItemAttributes allow you to specify custom attributes for the two elements (item and label) rendered by the control.

CheckBoxList
Supports new data-binding model based on data source controls. No longer requires explicit binding code.

DropDownList
Supports new data-binding model based on data source controls. No longer requires explicit binding code.

FileUpload (new)
Creates an HTML <input type="file"> control. Like the HtmlInputFile, but derives from WebControl, with all the rights and privileges pertaining thereto.

HiddenField (new)
Creates an HTML <input type="hidden"> control. Like the HtmlInputHidden, but derives from WebControl.

Image
New property GenerateEmptyAlternateText forces the control to render alt=""; without this property set, the control does not render an alt attribute. This gives you better control over accessibility.

ImageMap (new)
Allows you to define an HTML image map. You define the map like an Image control. You then define hotspots as child controls with appropriate sets of coordinates. For each hotspot, you can specify a mode (Navigate, PostBack) and related properties (NavigateUrl or PostBackValue, which is like CommandName in a Button control). If you perform a postback, you can get the PostBackValue for a particular hotspot.

Label
New AssociatedControlID property allows you to link a Label control with another control on the page. Renders an HTML label element. When users click the Label control or use its access key, focus passes to the associated control.

ListBox
Supports new data-binding model based on data source controls. No longer requires explicit binding code.

Literal
New LiteralMode property allows you to specify how the control treats the markup in its Text property (Transform, PassThrough, Encode).

MultiView, View (new)
Allows you to define multi-panel display where you can conditionally render different views. The MultiView control is the parent; you define two or more View controls as children which in turn contain markup and controls. You flip between views by setting the MultiView control's ActiveViewIndex property. This control was originally designed for mobile device browsers. Does not render any markup, just content. The control makes it slightly easier to create behavior otherwise possible with manually manipulating Panel controls (only no div) or by using the new Wizard control.

Panel
New property Scrollbars allows you to specify scrollbars (None, Horizontal, Vertical, Both, Auto).
New GroupingText property takes a string; it creates a group box around the panel (div) with a title.
New DefaultButton property specifies a default child button for that div; when users press ENTER inside a text box, the default button is invoked. (You can also now specify a default button for the form as a whole.)

RadioButton
New properties LabelAttributes and ItemAttributes allow you to specify custom attributes for the two elements (item and label) rendered by the control.

RadioButtonList
Supports new data-binding model based on data source controls. No longer requires explicit binding code.

Substitution (new)
Allows you to specify a region on the page that can be dynamically filled even on a cached page. You define a callback method for the control; in the method, you get whatever data you want, and whatever you return is injected into the page at the position of the Substitution control.

TextBox
New property AutoCompleteType allows you to specify where the text box might get its list of possible values. By default, browsers that support auto-complete will index possible values based on the name attribute. The AutoCompleteType property allows you to either specify none (do not use auto-complete) or any of various fields defined in the vcard schema.

TreeView (new)
Big honkin' control. Binds to hierarchical data (XML or derived from a relational source.)

Wizard (new)
Creates a multi-page control within the page. You can control navigation conditionally, etc.

XML
No changes.


Bill Evjen's Learn ASP.NET Page    (Bill Evjen's Blog)




alyssa   19 Jan 05 - 8:27 AM

Dude, I read this and thought wow. How did I POSSIBLY score a higher nerd score than you. It's unthinkable.

I demand a recount.


 
mike   20 Jan 05 - 6:29 AM

Well, I have to know this stuff for my job ... is job-related nerdiness less, you know, nerdy? Where I fall down on the nerd factors is in the math and the tech toys and calculators and stuff. I was, after all, a humanities major back in the day

BTW, I love your blog. But no RSS feed?


 
alyssa   20 Jan 05 - 8:37 AM

Mmm... calculators. As I type, I have a giant Casio calculator that must have been built in the time of the dinosaurs. Behold my cool tech toy!

No RSS for me - I'm lazy like that. But maybe I should investigate. Do you have any suggestions for an easy one?


 
mike   20 Jan 05 - 8:47 AM

Your blog engine (Blogger, yes?) should have some sort of feature that enables an RSS/XML feed. You might poke around in the options or configuration settings and see if that isn't supported. If so, it will just put a link on your blog page somewhere that we eager readers can copy into our aggregators. He said, still denying his nerdiness.

 
Corinne Hoisington   26 Mar 05 - 3:42 PM

One question. I have been testing ASP 2.0 for a few days, and am having one problem with the controls. In v1.0, you could place the controls anywhere you want them with the Image Layout setting. That seems to be gone and now when I place a control like a calendar, even with absolute positioning, it snaps back to the left edge. What am I doing wrong? Thanks

 
mike   26 Mar 05 - 3:53 PM

In VS, right? In VS 2005, so-called grid layout is not set for the page as a whole. Instead, you set it for individual controls. I think (I don't have it installed here at home, so this is memory) you select a control and then in the Layout menu you can choose positioning. Choose Absolute, and then you can drag the control anywhere. Under the covers, of course, you're adding the attribute:

style="positioning:absolute"

plus top and left values. Anyway, something like that.

Good luck!