|
<%@ Control Language="vb" AutoEventWireup="false" CodeBehind="SimpleGrid.ascx.vb" Inherits="ViewStateStorageExamples.SimpleGrid" %>
<asp:DataGrid id="EmployeeGrid" runat="server"
BorderColor="#999999"
BorderStyle="None"
BorderWidth="1px"
BackColor="White"
CellPadding="3"
GridLines="Vertical"
Font-Names="Arial"
AutoGenerateColumns="False"
Width="100%"
AllowPaging="true"
AllowSorting="true"
PageSize="5"
DataKeyField="EmployeeID"
OnEditCommand="EmployeeGrid_EditCommand"
OnUpdateCommand="EmployeeGrid_UpdateCommand"
OnCancelCommand="EmployeeGrid_CancelCommand"
OnDeleteCommand="EmployeeGrid_DeleteCommand"
OnSortCommand="EmployeeGrid_SortCommand"
OnPageIndexChanged="EmployeeGrid_PageIndexChanged" >
<FooterStyle ForeColor="Black" BackColor="#CCCCCC" />
<SelectedItemStyle Font-Bold="True" ForeColor="White" BackColor="#008A8C" />
<AlternatingItemStyle BackColor="Gainsboro" />
<ItemStyle ForeColor="Black" BackColor="#EEEEEE" />
<HeaderStyle Font-Bold="True" ForeColor="White" BackColor="#000084" />
<Columns>
<asp:TemplateColumn HeaderText="Name" SortExpression="LastName" >
<ItemStyle Width="10%" />
<ItemTemplate>
<%# DataBinder.Eval(Container, "DataItem.TitleOfCourtesy") + " " + DataBinder.Eval(Container, "DataItem.LastName") + ", " + DataBinder.Eval(Container, "DataItem.FirstName") %>
</ItemTemplate>
</asp:TemplateColumn>
<asp:TemplateColumn HeaderText="Address">
<ItemStyle Width="10%" />
<ItemTemplate>
<%# DataBinder.Eval(Container, "DataItem.Address") %>
</ItemTemplate>
<EditItemTemplate>
<asp:TextBox ID="Address" Text='<%# DataBinder.Eval(Container, "DataItem.Address") %>' Runat="server" />
</EditItemTemplate>
</asp:TemplateColumn>
<asp:BoundColumn DataField="City" ReadOnly="False" HeaderText="City" SortExpression="City" ItemStyle-Width="5%" />
<asp:BoundColumn DataField="Region" ReadOnly="False" HeaderText="Region" SortExpression="Region" ItemStyle-Width="2%"/>
<asp:BoundColumn DataField="PostalCode" ReadOnly="False" HeaderText="Postal Code" SortExpression="PostalCode" ItemStyle-Width="5%" />
<asp:BoundColumn DataField="Country" ReadOnly="False" HeaderText="Country" SortExpression="Country" ItemStyle-Width="3%" />
<asp:BoundColumn DataField="HomePhone" ReadOnly="False" HeaderText="Home Phone" SortExpression="HomePhone" ItemStyle-Width="5%" />
<asp:TemplateColumn HeaderText="Notes">
<ItemStyle Width="40%" />
<ItemTemplate>
<div style="height: 50px; overflow: auto;" >
<%#DataBinder.Eval(Container, "DataItem.Notes")%>
</div>
</ItemTemplate>
<EditItemTemplate>
<asp:TextBox ID="Notes" Text='<%# DataBinder.Eval(Container, "DataItem.Notes") %>' Runat="server" />
</EditItemTemplate>
</asp:TemplateColumn>
<asp:EditCommandColumn ButtonType="PushButton" UpdateText="Update" CancelText="Cancel" EditText="Edit"
ItemStyle-Width="15%" />
<asp:ButtonColumn Text="Delete" ButtonType="PushButton" CommandName="Delete" ItemStyle-Width="5%" />
</Columns>
<PagerStyle HorizontalAlign="Center" ForeColor="Black" BackColor="#999999" Mode="NumericPages" />
</asp:DataGrid>
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
Oleg Sobol has been developing web applications in ASP.NET using VB.NET for the past three years. Currently working for a leading online higher education provider, developing new online initiatives and supporting multiple education platforms.