需要仅过滤Telerik网格中的某些单元格

时间:2013-12-18 13:43:25

标签: asp.net telerik telerik-grid


我正在填充一些数据到rad网格,我需要过滤一些数据,如果用户需要。所以我检查了过滤选项。但现在过滤条件适用于所有细胞。所以我需要它在2个细胞上,它怎么可能。


    <telerik:RadGrid ID="RadGrid1" runat="server" 
                AllowPaging="True" AllowSorting="True" AutoGenerateColumns="False" 
                CellSpacing="0" DataSourceID="Patdetails" GridLines="None" 
                onneeddatasource="RadGrid1_NeedDataSource" ForeColor="#7090A1" AllowFilteringByColumn="True" 
                >

 <Columns>
    <telerik:GridTemplateColumn FilterControlAltText="Filter TemplateColumn column" 
        HeaderText="Select" UniqueName="TemplateColumn" HeaderStyle-Width="50px" >
        <ItemTemplate>
            <asp:CheckBox ID="chk_slct_pat" runat="server" />
        </ItemTemplate>
    </telerik:GridTemplateColumn>
    <telerik:GridBoundColumn DataField="Name"  AllowFiltering="true"
        FilterControlAltText="Filter column column" HeaderText="Name"
        UniqueName="column">
    </telerik:GridBoundColumn>
    <telerik:GridBoundColumn DataField="Sex" 
        FilterControlAltText="Filter column1 column" HeaderText="Gender" 
        UniqueName="column1">
    </telerik:GridBoundColumn>
    <telerik:GridBoundColumn DataField="age" 
        FilterControlAltText="Filter column2 column" HeaderText="Age" 
        UniqueName="column2">
    </telerik:GridBoundColumn>
    <telerik:GridBoundColumn DataField="dob" 
        FilterControlAltText="Filter column3 column" HeaderText="DOB" 
        UniqueName="column3">
    </telerik:GridBoundColumn>
    <telerik:GridBoundColumn DataField="hspt" 
        FilterControlAltText="Filter column4 column" HeaderText="Visit ID" 
        UniqueName="column4">
    </telerik:GridBoundColumn>
    <telerik:GridBoundColumn DataField="physician" 
        FilterControlAltText="Filter column5 column" HeaderText="Physician" 
        UniqueName="column5">
    </telerik:GridBoundColumn>
    <telerik:GridBoundColumn DataField="PCU" 
        FilterControlAltText="Filter column6 column" HeaderText="PCU" 
        UniqueName="column6">
    </telerik:GridBoundColumn>
</Columns>

<FilterMenu EnableImageSprites="False"></FilterMenu>
            </telerik:RadGrid>
            <asp:SqlDataSource ID="Patdetails" runat="server" 
                ConnectionString="<%$ ConnectionStrings:testdb_string %>" 
                SelectCommand="SELECT  TOP (50) Name,CASE WHEN Sex = 'F' THEN 'Female' ELSE 'Male' END AS Sex, Age,('*'+RTRIM(pv.hs])+('*')) AS hspt, PCU, [Discharge Date],CONVERT(VARCHAR(10), convert(date,[Date of Birth]), 101) as dob,pv.Physician,pv.[Admit Date]  FROM Patient_view AS pv WHERE ([Discharge Date] IS NULL) ORDER BY PCU">
            </asp:SqlDataSource>

1 个答案:

答案 0 :(得分:1)

将过滤属性添加到不具有过滤器的列并进行设置:

 <telerik:GridTemplateColumn AllowFiltering="false" Header.........

Saple