ShowHideGridViewColumnsServerFull.aspx
(开头部分) 6KB这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。
<%@ Page Title="Show / Hide Gridview Columns on the Server Side" Language="C#" MasterPageFile="~/MasterPage.master" AutoEventWireup="true" CodeFile="ShowHideGridViewColumnsServerFull.aspx.cs" Inherits="ShowHideGridViewColumnsServerFull" %>
<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" Runat="Server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="BodyContent" Runat="Server">
<h3>Show / Hide Gridview Columns on the Server Side</h3>
<a class="printHideMe" href="Default.aspx">Back to Menu</a>
<p class="description">
Try clicking on the minus symbols in the GridView column headers.
<br />Use the dropdown list to show the columns again.
<br />Try "Print Preview" in your browser to see how the page will print.
<br /><br />This example uses a SqlDataSource control and includes a MasterPage,
<br />an UpdatePanel and GridView editing, paging and sorting.
<br />Also, the Id column is hidden by default.
</p>
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>
<asp:GridView ID="GridView1" runat="server"
OnRowCreated="GridView1_RowCreated"
OnRowCommand="GridView1_RowCommand"
DataSourceID="SqlDataSource1" DataKeyNames="Id"
AllowSorting="True" AllowPaging="True" PageSize="3"
AutoGenerateColumns="False">
<HeaderStyle CssClass="gvHeader" />
<RowStyle CssClass="gvRow" />
<Columns>
<asp:CommandField ShowEditButton="True" />
<asp:TemplateField HeaderText="Id" SortExpression="Id">
<ItemTemplate>
<asp:Label ID="IdLabel" runat="server" Text='<%# Eval("Id") %>'></asp:Label>
</ItemTemplate>
<EditItemTemplate>
<asp:Label ID="Id" runat="server" Text='<%# Bind("Id") %>'></asp:Label>
</EditItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Description" SortExpression="Description">
<ItemTemplate>
<asp:Label ID="DescriptionLabel" runat="server" Text='<%# Eval("Description") %>'></asp:Label>
</ItemTemplate>
<EditItemTemplate>
<asp:TextBox ID="Description" runat="server" Text='<%# Bind("Description") %>' Width="175px"></asp:TextBox>
</EditItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Assigned To" SortExpression="AssignedTo">
<ItemTemplate>
<asp:Label ID="AssignedToLabel" runat="server" Text='<%# Eval("AssignedTo") %>'></asp:Label>
</ItemTemplate>
<EditItemTemplate>
<asp:DropDownList ID="AssignedTo" runat="server" SelectedValue='<%# Bind("AssignedTo") %>'>
<asp:ListItem></asp:ListItem>
<asp:ListItem>Andy</asp:ListItem>
<asp:ListItem>Betty</asp:ListItem>
<asp:ListItem>Conor</asp:ListItem>
<asp:ListItem>Declan</asp:ListItem>
<asp:ListItem>Eamon</asp:ListItem>
<asp:ListItem>Fergal</asp:ListItem>
<asp:ListItem>Gordon</asp:ListItem>
<asp:ListItem>Helen</asp:ListItem>
后面还有 56 行代码,解锁后查看完整代码
24 小时内免费解锁 3 个项目,之后 1 积分/个。 规则说明
AI 解读
登录后可用,每次 10 积分,解读结果公开显示在下面。
还没有人解读过这个文件。
