0

我有这个GridView使用自定义数据源:

<asp:ScriptManager ID="DateManager" runat="server" />

<asp:UpdatePanel ID="setDate" runat="server" 
    UpdateMode="Conditional" 
    ChildrenAsTriggers="true">
    <ContentTemplate>
        <asp:GridView ID="res" runat="server" 
            AutoGenerateColumns="False"
            CellPadding="4"
            ForeColor="#333333"
            GridLines="None"
            Width="600px" 
            AllowPaging="True">
            <AlternatingRowStyle BackColor="White" />

            <Columns>
                <asp:BoundField DataField="Ty" HeaderText="Type" />
                <asp:BoundField DataField="time" HeaderText="Time" />
                <asp:BoundField DataField="duration" HeaderText="Duration" />
                <asp:BoundField DataField="confirmed" HeaderText="Status" />
                <asp:CommandField SelectText="SelectIt" ShowSelectButton="True" />
            </Columns>

            <EditRowStyle BackColor="#2461BF" />
            <FooterStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
            <HeaderStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
            <PagerStyle BackColor="#2461BF" ForeColor="White" HorizontalAlign="Center" />
            <RowStyle BackColor="#EFF3FB" />
            <SelectedRowStyle BackColor="#D1DDF1" Font-Bold="True" ForeColor="#333333" />
            <SortedAscendingCellStyle BackColor="#F5F7FB" />
            <SortedAscendingHeaderStyle BackColor="#6D95E1" />
            <SortedDescendingCellStyle BackColor="#E9EBEF" />
            <SortedDescendingHeaderStyle BackColor="#4870BE" />
        </asp:GridView>
    </ContentTemplate>
</asp:UpdatePanel>

如何启用多项选择?

4

1 回答 1

1

您可以CheckBox像下面的代码一样在每一行附近添加并选择多行。

<asp:TemplateField>
    <ItemTemplate>
        <asp:CheckBox runat="server" ID="RowLevelCheckBox" />
    </ItemTemplate>
</asp:TemplateField>

有关详细信息,请查看以下文章:Article1 Article2

于 2013-04-11T13:09:12.443 回答