The Simple Web Controls

Team-Fly team-fly    

 
ADO.NET Programming in Visual Basic .NET
By Steve  Holzner, Bob  Howell

Table of Contents
Chapter 9.   Data Binding in Web Forms


The simple web controls support binding a single column to a single property. Just about every property of these controls can be bound to different columns . We already looked at the data bindings editor earlier. Let's look again (Figure 9.13).

Figure 9.13. The data bindings editor for the TextBox.

graphics/09fig13.jpg

Notice that you can bind to data columns, but you can also bind to page elements. If you scroll down the simple binding tree view you will see what I mean (see Figure 9.14).

Figure 9.14. The binding tree showing the page items.

graphics/09fig14.gif

I have a confession to make: I am not really a web guru. My expertise is in native Windows applications. It's not that I don't see the value in web applications. Quite the contrary. I'd be a fool not to acknowledge that web applications have become a mainstay of e-commerce as well as corporate intranets and the like. But I also still believe that the web is not God's gift to the computer challenged. The impression you get from listening to the hype about the Web is that it solves all of the problems with software distribution, user training, user 's having to learn complex applications, and myriad other issues. It does address some of these. Web applications do alleviate distribution woes. They are sometimes easier to use. But with these benefits there is the ever present trade-off.

Web application UIs still don't come remotely close to the kind of UI I can build in a native Windows application. Simple things that we take for granted like on-the-fly input editing, complex queries, look-up screens, real-time database updates, and multiuser concurrency handling are all orders of magnitude more difficult, if not impossible , with web applications. I'm not saying they can't be done. I just don't see how with the stateless nature of the Web.

I've said all this because I can't see why in heck you would ever want to data-bind a text box to the AcceptChangesDuringFill property (or any other property) of a DataAdapter.

The simple web controls and the most likely binding properties are:

  • TextBox Text property.

  • Label Text property.

  • Button Text property.

  • LinkButton Text property.

  • ImageButton This one's interesting. You can data-bind the ImageURL property to a text column in the database. So you can store the URL of the image in a database column, then just by changing the database you can change the image displayed in the button. This is true of all the controls that show images.

  • Hyperlink You can not only bind the Text property, but the URL of the link as well. This is useful for dynamically changing the linked URL at runtime.

  • CheckBox - RadioButton The Checked property is most likely to be bound to a Boolean database field. You can also bind the Text property which is the label displayed next to the check box.

  • Image ImageURL property, as with the ImageButton.

  • Panel Can be bound; I can't see why you would.

  • Calendar SelectedDate property. There are many other useful properties that can be bound to date ranges, and so forth. I'll leave it to you to investigate on your own.

  • AdRotator This control displays a series of banner ads on the page. The ads are contained in a file and you can bind the Advertisment-File property of the control to a database field.

  • Validator controls These controls are used to display custom field validation messages to the user. You can bind the ErrorMessage property to a database field.


Team-Fly team-fly    
Top


ADO. NET Programming in Visual Basic. NET
ADO.NET Programming in Visual Basic .NET (2nd Edition)
ISBN: 0131018817
EAN: 2147483647
Year: 2005
Pages: 123

Similar book on Amazon

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net