Irvine web design california - ASP.NET Flash
1. DataList…best of DataGrid and Data Repeater
A. Not restricted to Tabular Data like the grid.
1. Template based like repeater AND
B. Edit in place like Grid.
2. Key: Editing Templates in HTML View
A. ItemTemplate: Required. The default layout
1. AlternatingItemTemplate. For alternate rows.
B. And Header & Footer & Separator Templates
C. SelectItemTemplate: The item you clicked on
D. EditItemTemplate: If EditItemMode is on.
3. Template Styles; Appearance
A. Right click: Property Builder
B. Format allows you to configure appearance (style) for each template
C. Border adds table border attributes to the datalist tag.
4. DataBinding using Properties DataBinding….
A. Remember all this can be done in HTML as well as Databinding property.
B. Careful…be sure you select the right property to bind the DataBinder.Eval to!
C. Textbox..text, etc….
D. The following HTML view works showing some interesting techniques
ImageUrl='<%# "images\" & DataBinder.Eval(Container.DataItem,"ProductName") & ".jpg"%>'
1. Note the single quote around the entire attribute value…double quotes will not work.
5. Images for the Example are found in the Northwind Completed folder \images….
A. Just copy images folder into your working Northwind folder.
6. Using the CommandName, CommandArgument property in controls in the template
A. DataList checks the CommandName when you click on it
1. If it’s edit, update, delete, cancel it raises that eventnameCommand
a) EditCommand, CancelCommand, etc
B. And the CommandArgument can hold data..such as ID
7. Activating the EditItem Template
A. Because you placed edit in commandname it triggers the editcommand event.
B. datEmps.EditItemIndex = e.Item.ItemIndex…= edit selected item
C. rebind the control.
8. Getting data from the edit template in the UpdateCommand event
strFName = DataHandler.QuoteString(CType(e.Item.FindControl("txtFirstName"), TextBox).Text)
A. e.Item.FindControl(“txtFirstName”) returns the control by name
B. Ctype converts it to a TextBox which has a Text property.
C. The returned value is run through the QuoteString that
1. checks formats embedded quotes like O’Neil and
2. puts single quotes around the string value.a)