<%@ Page Language="vb" Inherits="Telerik.ListViewExamplesVBNET.DataEditing.NET2AutomaticDataEditing.DefaultVB"CodeFile="DefaultVB.aspx.vb" %>
<%@ Register TagPrefix="telerik" Namespace="Telerik.Web.UI" Assembly="Telerik.Web.UI" %>
<!DOCTYPE html>
<html xmlns='http://www.w3.org/1999/xhtml'>
<head runat="server">
<title>Telerik ASP.NET Example</title>
<link href="styles.css" rel="stylesheet" />
</head>
<body>
<form id="form1" runat="server">
<telerik:RadScriptManager runat="server" ID="RadScriptManager1" />
<telerik:RadSkinManager ID="RadSkinManager1" runat="server" ShowChooser="true" />
<div class="demo-container" id="demo-container">
<telerik:RadFormDecorator RenderMode="Lightweight" ID="RadFormDecorator1" runat="server" DecoratedControls="All" EnableRoundedCorners="false" DecorationZoneID="demo-container" />
<telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" runat="server">
</telerik:RadAjaxLoadingPanel>
<telerik:RadAjaxPanel runat="server" ID="AjaxPanel1" LoadingPanelID="RadAjaxLoadingPanel1">
<telerik:RadListView ID="RadListView1" RenderMode="Lightweight" DataSourceID="SqlDataSource1" runat="server"
ItemPlaceholderID="ProductItemContainer" DataKeyNames="ProductID" AllowPaging="True">
<LayoutTemplate>
<fieldset />
<legend>RadListView bound to SqlDataSource</legend>
<table class="layoutTable">
<tr>
<td class="button">
<telerik:RadButton RenderMode="Lightweight" ID="Button1" runat="server" CommandName="InitInsert" Visible="<%# Not Container.IsItemInserted %>"
Text="Add new product">
</telerik:RadButton>
</td>
</tr>
<tr>
<td>
<asp:Panel ID="ProductItemContainer" runat="server">
</asp:Panel>
</td>
</tr>
<tr>
<td>
<telerik:RadDataPager RenderMode="Lightweight" ID="RadDataPager1" runat="server" PagedControlID="RadListView1"
PageSize="3">
<Fields>
<telerik:RadDataPagerButtonField FieldType="FirstPrev"></telerik:RadDataPagerButtonField>
<telerik:RadDataPagerButtonField FieldType="Numeric"></telerik:RadDataPagerButtonField>
<telerik:RadDataPagerButtonField FieldType="NextLast"></telerik:RadDataPagerButtonField>
</Fields>
</telerik:RadDataPager>
</td>
</tr>
</table>
</fieldset>
</LayoutTemplate>
<ItemTemplate>
<fieldset class="itemFieldset">
<table class="itemTable">
<tr>
<td class="cellLabel">Name:
</td>
<td class="cellInfo">
<%# Eval("ProductName") %>
</td>
</tr>
<tr>
<td>Quantity:
</td>
<td class="cellInfo">
<%# Eval("QuantityPerUnit") %>
</td>
</tr>
<tr>
<td>Price:
</td>
<td class="cellInfo">
<%# DataBinder.Eval(Container.DataItem, "UnitPrice", "{0:C}") %>
</td>
</tr>
<tr>
<td>Units:
</td>
<td class="cellInfo">
<%# Eval("UnitsInStock") %>
</td>
</tr>
<tr>
<td>Discontinued:
</td>
<td class="cellInfo">
<asp:CheckBox ID="CheckBox1" runat="server" Checked='<%# Eval("Discontinued") %>'
Enabled="false"></asp:CheckBox>
</td>
</tr>
<tr>
<td colspan="2">
<asp:ImageButton ID="Button1" runat="server" CommandName="Edit" ImageUrl="~/ListView/Examples/DefiningStructure/DeclarativeDefinition/images/Edit.gif"></asp:ImageButton>
<asp:ImageButton ID="Button2" runat="server" CommandName="Delete" ImageUrl="~/ListView/Examples/DefiningStructure/DeclarativeDefinition/images/Delete.gif"></asp:ImageButton>
</td>
</tr>
</table>
</fieldset>
</ItemTemplate>
<EditItemTemplate>
<fieldset class="itemFieldset">
<table class="itemTable">
<tr>
<td class="cellLabel">Name:
</td>
<td class="cellInfo">
<asp:TextBox ID="TextBox1" runat="server" Text='<%# Bind("ProductName") %>' Width="120px" ValidationGroup="ProductGroup"></asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidator1" ControlToValidate="TextBox1" ValidationGroup="ProductGroup"
ForeColor="Red" Text="*This field is required" runat="server" Display="Dynamic">
</asp:RequiredFieldValidator>
</td>
</tr>
<tr>
<td>Quantity:
</td>
<td class="cellInfo">
<asp:TextBox ID="TextBox2" runat="server" Text='<%# Bind("QuantityPerUnit") %>' Width="120px"></asp:TextBox>
</td>
</tr>
<tr>
<td>Price:
</td>
<td class="cellInfo">
<telerik:RadNumericTextBox RenderMode="Lightweight" ID="TextBox3" runat="server" DbValue='<%# Bind("UnitPrice") %>'
Width="80px" MinValue="0" MaxValue="999">
</telerik:RadNumericTextBox>
</td>
</tr>
<tr>
<td>Units:
</td>
<td class="cellInfo">
<telerik:RadNumericTextBox RenderMode="Lightweight" ID="TextBox4" runat="server" DbValue='<%# Bind("UnitsInStock") %>'
Width="80px" MinValue="0" MaxValue="100">
</telerik:RadNumericTextBox>
</td>
</tr>
<tr>
<td>Discontinued:
</td>
<td class="cellInfo">
<asp:CheckBox ID="CheckBox1" runat="server" Checked='<%# Bind("Discontinued") %>'></asp:CheckBox>
</td>
</tr>
<tr>
<td colspan="2">
<asp:ImageButton ID="Button1" runat="server" CommandName="Update" ValidationGroup="ProductGroup" ImageUrl="~/ListView/Examples/DefiningStructure/DeclarativeDefinition/images/Update.gif"></asp:ImageButton>
<asp:ImageButton ID="Button2" runat="server" CommandName="Cancel" ImageUrl="~/ListView/Examples/DefiningStructure/DeclarativeDefinition/images/Cancel.gif"></asp:ImageButton>
</td>
</tr>
</table>
</fieldset>
</EditItemTemplate>
<InsertItemTemplate>
<fieldset class="itemFieldset">
<table class="itemTable">
<tr>
<td class="cellLabel">Name:
</td>
<td class="cellInfo">
<asp:TextBox ID="TextBox11" runat="server" Text='<%# Bind("ProductName") %>' Width="120px" ValidationGroup="ProductGroupInsert"></asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidator2" ControlToValidate="TextBox11" ValidationGroup="ProductGroupInsert"
ForeColor="Red" Text="*This field is required" runat="server" Display="Dynamic">
</asp:RequiredFieldValidator>
</td>
</tr>
<tr>
<td>Quantity:
</td>
<td class="cellInfo">
<asp:TextBox ID="TextBox2" runat="server" Text='<%# Bind("QuantityPerUnit") %>' Width="120px">
</asp:TextBox>
</td>
</tr>
<tr>
<td>Price:
</td>
<td class="cellInfo">
<telerik:RadNumericTextBox RenderMode="Lightweight" ID="TextBox3" runat="server" DbValue='<%# Bind("UnitPrice") %>'
Width="80px" MinValue="0" MaxValue="999">
</telerik:RadNumericTextBox>
</td>
</tr>
<tr>
<td>Units:
</td>
<td class="cellInfo">
<telerik:RadNumericTextBox RenderMode="Lightweight" ID="TextBox4" runat="server" DbValue='<%# Bind("UnitsInStock") %>'
Width="80px" MinValue="0" MaxValue="100">
</telerik:RadNumericTextBox>
</td>
</tr>
<tr>
<td>Discontinued:
</td>
<td class="cellInfo">
<asp:CheckBox ID="CheckBox1" runat="server" Checked='<%# Bind("Discontinued") %>'></asp:CheckBox>
</td>
</tr>
<tr>
<td colspan="2">
<asp:ImageButton ID="Button1" runat="server" CommandName="PerformInsert" ValidationGroup="ProductGroupInsert" ImageUrl="~/ListView/Examples/DefiningStructure/DeclarativeDefinition/images/Update.gif"></asp:ImageButton>
<asp:ImageButton ID="Button2" runat="server" CommandName="Cancel" ImageUrl="~/ListView/Examples/DefiningStructure/DeclarativeDefinition/images/Cancel.gif"></asp:ImageButton>
</td>
</tr>
</table>
</fieldset>
</InsertItemTemplate>
</telerik:RadListView>
<br />
<telerik:RadListView ID="RadListView2" RenderMode="Lightweight" DataSourceID="ObjectDataSource1" runat="server"
ItemPlaceholderID="ProductItemContainer" DataKeyNames="ProductID" AllowPaging="True">
<LayoutTemplate>
<fieldset class="mainFieldset">
<legend>RadListView bound to ObjectDataSource</legend>
<table class="layoutTable">
<tr>
<td class="button">
<telerik:RadButton RenderMode="Lightweight" ID="Button1" runat="server" CommandName="InitInsert" Visible="<%# Not Container.IsItemInserted %>"
Text="Add new product">
</telerik:RadButton>
</td>
</tr>
<tr>
<td>
<asp:Panel ID="ProductItemContainer" runat="server">
</asp:Panel>
</td>
</tr>
<tr>
<td>
<telerik:RadDataPager RenderMode="Lightweight" ID="RadDataPager1" runat="server" PagedControlID="RadListView2"
PageSize="3">
<Fields>
<telerik:RadDataPagerButtonField FieldType="FirstPrev"></telerik:RadDataPagerButtonField>
<telerik:RadDataPagerButtonField FieldType="Numeric"></telerik:RadDataPagerButtonField>
<telerik:RadDataPagerButtonField FieldType="NextLast"></telerik:RadDataPagerButtonField>
</Fields>
</telerik:RadDataPager>
</td>
</tr>
</table>
</fieldset>
</LayoutTemplate>
<ItemTemplate>
<fieldset class="itemFieldset">
<table class="itemTable">
<tr>
<td class="cellLabel">Name:
</td>
<td class="cellInfo">
<%# Eval("ProductName") %>
</td>
</tr>
<tr>
<td>Quantity:
</td>
<td class="cellInfo">
<%# Eval("QuantityPerUnit") %>
</td>
</tr>
<tr>
<td>Price:
</td>
<td class="cellInfo">
<%# DataBinder.Eval(Container.DataItem, "UnitPrice", "{0:C}") %>
</td>
</tr>
<tr>
<td>Units:
</td>
<td class="cellInfo">
<%# Eval("UnitsInStock") %>
</td>
</tr>
<tr>
<td>Discontinued:
</td>
<td class="cellInfo">
<asp:CheckBox ID="CheckBox1" runat="server" Checked='<%# Eval("Discontinued") %>'
Enabled="false"></asp:CheckBox>
</td>
</tr>
<tr>
<td colspan="2">
<asp:ImageButton ID="Button1" runat="server" CommandName="Edit" ImageUrl="~/ListView/Examples/DefiningStructure/DeclarativeDefinition/images/Edit.gif"></asp:ImageButton>
<asp:ImageButton ID="Button2" runat="server" CommandName="Delete" ImageUrl="~/ListView/Examples/DefiningStructure/DeclarativeDefinition/images/Delete.gif"></asp:ImageButton>
</td>
</tr>
</table>
</fieldset>
</ItemTemplate>
<EditItemTemplate>
<fieldset class="itemFieldset">
<table class="itemTable">
<tr>
<td class="cellLabel">Name:
</td>
<td class="cellInfo">
<asp:TextBox ID="TextBox12" runat="server" Text='<%# Bind("ProductName") %>' Width="120px" ValidationGroup="ProductGroup2"></asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidator1" ControlToValidate="TextBox12" ValidationGroup="ProductGroup2"
ForeColor="Red" Text="*This field is required" runat="server" Display="Dynamic">
</asp:RequiredFieldValidator>
</td>
</tr>
<tr>
<td>Quantity:
</td>
<td class="cellInfo">
<asp:TextBox ID="TextBox2" runat="server" Text='<%# Bind("QuantityPerUnit") %>' Width="120px"></asp:TextBox>
</td>
</tr>
<tr>
<td>Price:
</td>
<td class="cellInfo">
<telerik:RadNumericTextBox RenderMode="Lightweight" ID="TextBox3" runat="server" DbValue='<%# Bind("UnitPrice") %>'
Width="80px" MinValue="0" MaxValue="999">
</telerik:RadNumericTextBox>
</td>
</tr>
<tr>
<td>Units:
</td>
<td class="cellInfo">
<telerik:RadNumericTextBox RenderMode="Lightweight" ID="TextBox4" runat="server" DbValue='<%# Bind("UnitsInStock") %>'
Width="80px" MinValue="0" MaxValue="100">
</telerik:RadNumericTextBox>
</td>
</tr>
<tr>
<td>Discontinued:
</td>
<td class="cellInfo">
<asp:CheckBox ID="CheckBox1" runat="server" Checked='<%# Bind("Discontinued") %>'></asp:CheckBox>
</td>
</tr>
<tr>
<td colspan="2">
<asp:ImageButton ID="Button1" runat="server" CommandName="Update" ValidationGroup="ProductGroup2" ImageUrl="~/ListView/Examples/DefiningStructure/DeclarativeDefinition/images/Update.gif"></asp:ImageButton>
<asp:ImageButton ID="Button2" runat="server" CommandName="Cancel" ImageUrl="~/ListView/Examples/DefiningStructure/DeclarativeDefinition/images/Cancel.gif"></asp:ImageButton>
</td>
</tr>
</table>
</fieldset>
</EditItemTemplate>
<InsertItemTemplate>
<fieldset class="itemFieldset">
<table class="itemTable">
<tr>
<td class="cellLabel">Name:
</td>
<td class="cellInfo">
<asp:TextBox ID="TextBox13" runat="server" Text='<%# Bind("ProductName") %>' Width="120px" ValidationGroup="ProductGroup2Insert"></asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidator1" ControlToValidate="TextBox13" ValidationGroup="ProductGroup2Insert"
ForeColor="Red" Text="*This field is required" runat="server" Display="Dynamic">
</asp:RequiredFieldValidator>
</td>
</tr>
<tr>
<td>Quantity:
</td>
<td class="cellInfo">
<asp:TextBox ID="TextBox2" runat="server" Text='<%# Bind("QuantityPerUnit") %>' Width="120px"></asp:TextBox>
</td>
</tr>
<tr>
<td>Price:
</td>
<td class="cellInfo">
<telerik:RadNumericTextBox RenderMode="Lightweight" ID="TextBox3" runat="server" DbValue='<%# Bind("UnitPrice") %>'
Width="80px" MinValue="0" MaxValue="999">
</telerik:RadNumericTextBox>
</td>
</tr>
<tr>
<td>Units:
</td>
<td class="cellInfo">
<telerik:RadNumericTextBox RenderMode="Lightweight" ID="TextBox4" runat="server" DbValue='<%# Bind("UnitsInStock") %>'
Width="80px" MinValue="0" MaxValue="100">
</telerik:RadNumericTextBox>
</td>
</tr>
<tr>
<td>Discontinued:
</td>
<td class="cellInfo">
<asp:CheckBox ID="CheckBox1" runat="server" Checked='<%# Bind("Discontinued") %>'></asp:CheckBox>
</td>
</tr>
<tr>
<td colspan="2">
<asp:ImageButton ID="Button1" runat="server" CommandName="PerformInsert" ValidationGroup="ProductGroup2Insert" ImageUrl="~/ListView/Examples/DefiningStructure/DeclarativeDefinition/images/Update.gif"></asp:ImageButton>
<asp:ImageButton ID="Button2" runat="server" CommandName="Cancel" ImageUrl="~/ListView/Examples/DefiningStructure/DeclarativeDefinition/images/Cancel.gif"></asp:ImageButton>
</td>
</tr>
</table>
</fieldset>
</InsertItemTemplate>
</telerik:RadListView>
</telerik:RadAjaxPanel>
<asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:NorthwindConnectionString35 %>"
DeleteCommand="DELETE FROM [Products] WHERE [ProductID] = @ProductID" InsertCommand="INSERT INTO [Products] ([ProductName], [SupplierID], [CategoryID], [QuantityPerUnit], [UnitPrice], [UnitsInStock], [UnitsOnOrder], [ReorderLevel], [Discontinued]) VALUES (@ProductName, @SupplierID, @CategoryID, @QuantityPerUnit, @UnitPrice, @UnitsInStock, @UnitsOnOrder, @ReorderLevel, @Discontinued)"
SelectCommand="SELECT * FROM [Products]" UpdateCommand="UPDATE [Products] SET [ProductName] = @ProductName, [SupplierID] = @SupplierID, [CategoryID] = @CategoryID, [QuantityPerUnit] = @QuantityPerUnit, [UnitPrice] = @UnitPrice, [UnitsInStock] = @UnitsInStock, [UnitsOnOrder] = @UnitsOnOrder, [ReorderLevel] = @ReorderLevel, [Discontinued] = @Discontinued WHERE [ProductID] = @ProductID">
<DeleteParameters>
<asp:Parameter Name="ProductID" Type="Int32"></asp:Parameter>
</DeleteParameters>
<UpdateParameters>
<asp:Parameter Name="ProductName" Type="String"></asp:Parameter>
<asp:Parameter Name="SupplierID" Type="Int32"></asp:Parameter>
<asp:Parameter Name="CategoryID" Type="Int32"></asp:Parameter>
<asp:Parameter Name="QuantityPerUnit" Type="String"></asp:Parameter>
<asp:Parameter Name="UnitPrice" Type="Decimal"></asp:Parameter>
<asp:Parameter Name="UnitsInStock" Type="Int16"></asp:Parameter>
<asp:Parameter Name="UnitsOnOrder" Type="Int16"></asp:Parameter>
<asp:Parameter Name="ReorderLevel" Type="Int16"></asp:Parameter>
<asp:Parameter Name="Discontinued" Type="Boolean"></asp:Parameter>
<asp:Parameter Name="ProductID" Type="Int32"></asp:Parameter>
</UpdateParameters>
<InsertParameters>
<asp:Parameter Name="ProductName" Type="String"></asp:Parameter>
<asp:Parameter Name="SupplierID" Type="Int32"></asp:Parameter>
<asp:Parameter Name="CategoryID" Type="Int32"></asp:Parameter>
<asp:Parameter Name="QuantityPerUnit" Type="String"></asp:Parameter>
<asp:Parameter Name="UnitPrice" Type="Decimal"></asp:Parameter>
<asp:Parameter Name="UnitsInStock" Type="Int16"></asp:Parameter>
<asp:Parameter Name="UnitsOnOrder" Type="Int16"></asp:Parameter>
<asp:Parameter Name="ReorderLevel" Type="Int16"></asp:Parameter>
<asp:Parameter Name="Discontinued" Type="Boolean"></asp:Parameter>
</InsertParameters>
</asp:SqlDataSource>
<asp:ObjectDataSource runat="server" ID="ObjectDataSource1" DeleteMethod="Delete"
InsertMethod="Insert" OldValuesParameterFormatString="original_{0}" SelectMethod="GetData"
TypeName="ListViewAutomaticOperationsDataSourceTableAdapters.ProductsTableAdapter"
UpdateMethod="Update">
<DeleteParameters>
<asp:Parameter Name="Original_ProductID" Type="Int32"></asp:Parameter>
</DeleteParameters>
<UpdateParameters>
<asp:Parameter Name="ProductName" Type="String"></asp:Parameter>
<asp:Parameter Name="SupplierID" Type="Int32"></asp:Parameter>
<asp:Parameter Name="CategoryID" Type="Int32"></asp:Parameter>
<asp:Parameter Name="QuantityPerUnit" Type="String"></asp:Parameter>
<asp:Parameter Name="UnitPrice" Type="Decimal"></asp:Parameter>
<asp:Parameter Name="UnitsInStock" Type="Int16"></asp:Parameter>
<asp:Parameter Name="UnitsOnOrder" Type="Int16"></asp:Parameter>
<asp:Parameter Name="ReorderLevel" Type="Int16"></asp:Parameter>
<asp:Parameter Name="Discontinued" Type="Boolean"></asp:Parameter>
<asp:Parameter Name="Original_ProductID" Type="Int32"></asp:Parameter>
</UpdateParameters>
<InsertParameters>
<asp:Parameter Name="ProductName" Type="String"></asp:Parameter>
<asp:Parameter Name="SupplierID" Type="Int32"></asp:Parameter>
<asp:Parameter Name="CategoryID" Type="Int32"></asp:Parameter>
<asp:Parameter Name="QuantityPerUnit" Type="String"></asp:Parameter>
<asp:Parameter Name="UnitPrice" Type="Decimal"></asp:Parameter>
<asp:Parameter Name="UnitsInStock" Type="Int16"></asp:Parameter>
<asp:Parameter Name="UnitsOnOrder" Type="Int16"></asp:Parameter>
<asp:Parameter Name="ReorderLevel" Type="Int16"></asp:Parameter>
<asp:Parameter Name="Discontinued" Type="Boolean"></asp:Parameter>
</InsertParameters>
</asp:ObjectDataSource>
</div>
</form>
</body>
</html>