This is a migrated thread and some comments may be shown as answers.

Default filter doesnt work

2 Answers 127 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Xi
Top achievements
Rank 1
Xi asked on 04 Jul 2008, 03:26 PM
I have a RadGrid with some columns, I want to apply a default filter on one of them so that when the page loads only the filtered data is displayed.  I tried putting this in the aspx page, however I always get an 'expression expected' error
<MasterTableView DataKeyNames="OutageID,OutageSubject,StartDate"  CommandItemDisplay="TopAndBottom"  
            FilterExpression="([OutageStatusName] LIKE '%Outstanding%')" > 
            <Columns>                   
                <telerik:GridHyperLinkColumn HeaderText="" DataNavigateUrlFormatString="OutageDetails.aspx?OutageID={0}"  DataNavigateUrlFields="OutageID" AllowFiltering="false"  DataTextFormatString="Edit" DataTextField="OutageID" > 
                    <HeaderStyle Wrap="false" /> 
                    <ItemStyle HorizontalAlign="Left" /> 
                </telerik:GridHyperLinkColumn>    
                <telerik:GridBoundColumn DataField="OutageID" HeaderText="ID" UniqueName="OutageID"
                    <ItemStyle Width="40px" /> 
                    <HeaderStyle Width="40px" /> 
                </telerik:GridBoundColumn>                      
                <telerik:GridBoundColumn DataField="ResponsibleOrganizationName" HeaderText="Resp. Org" UniqueName="ResponsibleOrganizationName"
                    <ItemStyle Width="60px" /> 
                    <HeaderStyle Width="60px" /> 
                </telerik:GridBoundColumn> 
                <telerik:GridBoundColumn DataField="OutageSubject" HeaderText="Subject" UniqueName="OutageSubject"
                    <ItemStyle Width="250px" Wrap="False" /> 
                </telerik:GridBoundColumn>                 
                <telerik:GridBoundColumn DataField="StartDate" HeaderText="StartDate" UniqueName="StartDate"
                </telerik:GridBoundColumn>   
                <telerik:GridBoundColumn DataField="EndDate" HeaderText="EndDate" UniqueName="EndDate"
                </telerik:GridBoundColumn>                                                                                    
                <telerik:GridHyperLinkColumn HeaderText="SMA Link" DataNavigateUrlFormatString="http://sma2/Support/TicketDetails.aspx?PNumber={0}" DataTextFormatString="{0}"  DataTextField="SMANumber" DataNavigateUrlFields="SMANumber" UniqueName="SMANumber"
                    <HeaderStyle Wrap="False" /> 
                    <ItemStyle HorizontalAlign="Center" /> 
                </telerik:GridHyperLinkColumn>                  
                <telerik:GridBoundColumn DataField="OutageStatusName" HeaderText="Status" UniqueName="OutageStatusName"  
                    CurrentFilterFunction="Contains" CurrentFilterValue="Outstanding"
                </telerik:GridBoundColumn>  
                <%--<telerik:GridButtonColumn HeaderText="OCS" UniqueName="OCS" ButtonType="ImageButton" ImageUrl="~/Images/send-ocs.gif" CommandName="OCS" ConfirmText="Are you sure you wish to broadcast an OCS Message?" Visible="false"></telerik:GridButtonColumn> --%> 
            </Columns> 

2 Answers, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 05 Jul 2008, 06:28 AM
Hello Xi,

I tried the same scenario at my end and its working fine. Are you using AdvancedDataBinding techniques to bind the Grid?

ASPX:
<MasterTableView FilterExpression="([FirstName] LIKE '%Fiona%')" DataSourceID="SqlDataSource1">                          
                   <Columns>                      
                        <telerik:GridBoundColumn DataField="FirstName" CurrentFilterFunction="Contains" CurrentFilterValue="Fiona" HeaderText="FirstName"  UniqueName="FirstName"
                        </telerik:GridBoundColumn>                         
                   </Columns>      
                   
</MasterTableView> 

Thanks
Princy.

0
Xi
Top achievements
Rank 1
answered on 07 Jul 2008, 02:36 PM
Hi Princy,

Thanks for the reply.  For my grid I'm using RadGrid1_NeedDataSource for the datasource, as well as a DataBind call in the Page Load function
Tags
Grid
Asked by
Xi
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Xi
Top achievements
Rank 1
Share this question
or