Jadi udah download VS2008 RTM nih ceritanya... mari kita liat fitur baru di ASP.NET 3.5
1. Klik File | New | Web Site. Pilih ASP.NET Web Site, jangan lupa pilih .NET Framework 3.5
2. Klik kanan Project, Add New Item | SQL Server Database.
- Di Server Explorer, klik kanan Tables | Add New Table
- Tambahin data berikut:
| Column Name |
Data Type |
Allow Nulls |
Comment |
| id |
int |
no |
set Is Identity=true set primary key |
| nama |
varchar(50) |
no |
|
| jumlah_istri |
int |
no |
|
- Save Table sebagai Table1.
3. Klik kanan Project, Add New Item | LINQ to SQL Classes
- Drag Table1 dari Server Explorer ke Object Relational Designer canvas (sebelah kiri), jangan ke canvas sebelah kanan.
4. Buka Default.aspx dalam Design View. Tarik LinqDataSource dari Toolbox ke Design canvas.
- Di SmartTask LinqDataSource, klik Configure Data Source.
- Pilih DataClassesDataContext, klik Next.
- Pilih Table1s(<Table<Table1>) dan klik Finish.
- Klik Enable Delete, Insert, Update
5. Tarik ScriptManager dari Toolbox ke Design canvas.
- Tarik UpdatePanel dari Toolbox ke Design canvas.
- Tarik ListView dari Toolbox ke UpdatePanel di Design canvas.
- Pilih LinqDataSource1 untuk DataSource ListView:
- Klik Configure ListView, pilih Layout(Grid), Style(Professional), dan Enable Editing, Inserting, Deleting, Paging.
6. Tekan F5, dan enjoy halaman CRUD + Ajax Anda tanpa coding :)
Apa itu ListView? Intinya sih GridView + User Templates... bagi yg udah main-main CommunityServer, biasa ngeliat control dengan model templates seperti ini nih. Berikut templates yg ada:
LayoutTemplate
The root template that defines a container object, such as a table, div, or span element, that will contain the content defined in the ItemTemplate or GroupTemplate template. It might also contain a DataPager object.
ItemTemplate
Defines the data-bound content to display for individual items.
ItemSeparatorTemplate
Defines the content to render between individual items.
GroupTemplate
Defines a container object, such as a table row (tr), div, or span element, that will contain the content defined in the ItemTemplate and EmptyItemTemplate templates. The number of items that are displayed in a group is specified by the GroupItemCount property.
GroupSeparatorTemplate
Defines the content to render between groups of items.
EmptyItemTemplate
Defines the content to render for an empty item when a GroupTemplate template is used. For example, if the GroupItemCount property is set to 5, and the total number of items returned from the data source is 8, the last group of data displayed by the ListView control will contain three items as specified by the ItemTemplate template, and two items as specified by the EmptyItemTemplate template.
EmptyDataTemplate
Defines the content to render if the data source returns no data.
SelectedItemTemplate
Defines the content to render for the selected data item to differentiate the selected item from other items.
AlternatingItemTemplate
Defines the content to render for alternating items to make it easier to distinguish between consecutive items.
EditItemTemplate
Defines the content to render when an item is being edited. The EditItemTemplate template is rendered in place of the ItemTemplate template for the data item that is being edited.
InsertItemTemplate
Defines the content to render to insert an item. The InsertItemTemplate template is rendered in place of an ItemTemplate template at either the start or at the end of the items that are displayed by the ListView control. You can specify where the InsertItemTemplate template is rendered by using the InsertItemPosition property of the ListView control.