用户如何选择要在gridview中查看的数据

时间:2013-01-14 11:54:47

标签: c# asp.net

我有一个gridview,其中包含我想要的100行,用户可以选择要查看的网格中的行数(表示该标题的头部和数据)。你有什么想法吗? 例如:

SL     NO       NAME     DATE       END DATE           SUB TOTAL             TOTAL 
==================================================================================


==================================================================================

用户可以选择他只想在gridview中看到SL NAME SUB TOTAL TOTAL,之后Grid会显示这样的数据

SL            NAME                   SUB TOTAL                          TOTAL
==============================================================================



==============================================================================

我像这样绑定

<data:ActiveOrdersDataSource ID="ActiveOrdersDataSourcebyCompany" runat="server" SelectMethod="GetPaged" EnablePaging="True" EnableSorting="True" EnableDeepLoad="True">
    <DeepLoadProperties Method="IncludeChildren" Recursive="False">
        <Types>
            <data:ActiveOrdersProperty Name="Clients" />
            <data:ActiveOrdersProperty Name="Companies" />
            <data:ActiveOrdersProperty Name="Drivers" />
            <data:ActiveOrdersProperty Name="SalesPeople" />
            <data:ActiveOrdersProperty Name="ServiceTypes" />
            <data:ActiveOrdersProperty Name="VehicleTypes" />
            <data:ActiveOrdersProperty Name="Zones" />
        </Types>
    </DeepLoadProperties>
    <Parameters>
        <asp:SessionParameter Name="CompanyId" SessionField="CompanyId" Type="String" />
        <data:SqlParameter Name="WhereClause" UseParameterizedFilters ="false">
            <Filters>
                <data:ActiveOrdersFilter Column="CompanyId" ControlID="ddlCompany" PropertyName="SelectedValue" ComparisionType="Equals" />
                <data:ActiveOrdersFilter Column="AccountNumber" ControlID="ddlAccount" PropertyName="SelectedValue" ComparisionType="Equals" />
                <data:ActiveOrdersFilter Column="ServiceTypeId" ControlID="ddlService" PropertyName="SelectedValue" ComparisionType="Equals" />
                <data:ActiveOrdersFilter Column="VehicleTypeId" ControlID="ddlVehicle" PropertyName="SelectedValue" ComparisionType="Equals" />
                <data:ActiveOrdersFilter Column="StatusId" ControlID="ddlStatus" PropertyName="SelectedValue" ComparisionType="Equals" />
                <data:ActiveOrdersFilter Column="OrderNo" ControlID="txtOrderNumber" ComparisionType="Contains" />
            </Filters>
        </data:SqlParameter> 
    </Parameters>
</data:ActiveOrdersDataSource>

1 个答案:

答案 0 :(得分:1)

您可以通过在每列上设置Visibility属性,根据用户首选项更改列的可见性。如果您使用的是ObjectDataSource,则可以通过设置PageSize来控制行数。