TAILIEUCHUNG - Professional ASP.NET 1.0 Special Edition- P13
Professional Special Edition- P13:Those of us who are Microsoft developers can't help but notice that .NET has received a fair amount of visibility over the last year or so. This is quite surprising considering that for most of this period, .NET has been in its early infancy and beta versions. I can't remember any unreleased product that has caused this much interest among developers. And that's really an important point, because ignoring all the hype and press, .NET really is a product for developers, providing a great foundation for building all types of applications | BindDataGrid bind the data and display it End Sub Canceling Edit Mode Canceling edit mode is the same as we did on our DataGrid example previously. In the definition of the DataList control we specified our routine named DoItemCancel as the event handler for the Cancelcommand event. In this routine we just set the EditItemlndex property of the DataList control to -1 and rebind the grid Sub DoItemCancel objSource As Object objArgs As DataListCommandEventArgs set EditItemIndex property of grid to -1 to switch out of Edit mode -1 BindDataGrid bind the data and display it End Sub And that s it. We ve built a responsive intuitive and attractive data update page with only a handful of controls and relatively few lines of code. To do the same using ASP would take a great deal longer and require a great deal more effort and a lot more code. What we haven t done is look very deeply at how the relational data management processes are carried out. We ve used fairly simple data access code to get sets of data from a database and just displayed the explicit SQL statements we could use to perform updates. However the next four chapters of this book are devoted to data management using both relational data and XML. Summary In this chapter we ve looked in some detail at a specific new feature that is available when using namely server-side data binding. This allows us to insert values from a range of different types of data source into a page or into controls on a page. Together with the eight special list controls that are part of the .NET Framework this allows us to build data-driven pages with a minimum of code and effort. There are two basic types of data binding supported in single-value binding to any control and repeated-value binding to the special list controls. Single-value binding can be used with a property method result or an expression to create a value that is then used to set a property or the content of any other .
đang nạp các trang xem trước