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

Date Filter Problem

3 Answers 122 Views
Grid
This is a migrated thread and some comments may be shown as answers.
kiran
Top achievements
Rank 1
kiran asked on 05 Feb 2009, 06:35 AM
Hi Friends,
    i am using radgrid to display some records which includes date filed also.
   
    In the grid i have provider filter option in the command item template as specified below

<telerik:GridTemplateColumn HeaderStyle-Width="75px" HeaderText="Modified" ItemStyle-Width="75px" UniqueName="Modified">
    <ItemTemplate>
    <asp:Label ID="lblModified" runat="server" Text='<%# iif(Eval("Modified") & "" <> "",format(Eval("Modified"),"MM/dd/yyyy"),"")  %>'></asp:Label>
    </ItemTemplate>
</telerik:GridTemplateColumn>
'-------------------------------------------------------------------------------------------------------------------------
    <CommandItemTemplate>
    <asp:TextBox  autocomplete="off"  ID="txtSearch" runat="server" EnableTheming ="true"></asp:TextBox>
    <telerik:RadCombobox ID="rcbFieldName" runat="server" AllowCustomText="True"
        <Items>
            <telerik:RadComboBoxItem Text="Name" Value="StructureName LIKE '%-VALUE-%'" />
            <telerik:RadComboBoxItem Text="Description" Value="Description LIKE '%-VALUE-%'" />
            <telerik:RadComboBoxItem Text="Created" Value="Created LIKE %-VALUE-%'" />
            <telerik:RadComboBoxItem Text="Modified" Value="Modified LIKE '%-VALUE-%'" />
        </Items>
        <collapseanimation duration="200" type="OutQuint"></collapseanimation>
    </telerik:RadCombobox>
</CommandItemTemplate>
'----------------------------------------------------------------------------------------------------------

Protected Sub RadGrid1_ItemCommand(ByVal source As Object, ByVal e As Telerik.Web.UI.GridCommandEventArgs) Handles RadGrid1.ItemCommand
            Case "FilterUsersBy"
                Dim txtSearch As TextBox = CType(e.Item.FindControl("txtSearch"), TextBox)
                Dim rcbFieldName As RadComboBox = CType(e.Item.FindControl("rcbFieldName"), RadComboBox)
                RadGrid1.MasterTableView.FilterExpression = Replace(rcbFieldName.SelectedValue, "%-VALUE-%", txtSearch.Text)
                RadAjaxManager1.Alert(RadGrid1.MasterTableView.FilterExpression.ToString)
                RadAjaxManager1.Alert(RadGrid1.MasterTableView.e
                RadGrid1.MasterTableView.Rebind()
         End Select
end sub

my search for date is not working (but for the othere 2 fileds its working fine)
i am not sure whether the code is wrong or the input for search i am providing is wrong

wht is the format i have to search for date '02/21/2009' or '02/21/2009  00:00:00.000'

can any one plzzz help me........

Thanx in advance




 

3 Answers, 1 is accepted

Sort by
0
Yavor
Telerik team
answered on 09 Feb 2009, 01:55 PM
Hi kiran,

Since the filter expression is working for the other two columns, I assume that the filter expression is properly passed and constructed. For the date column, you can make sure that the date passed is present in the database - for example that you are not passing simply the date, and not the hour portion, if such is contained in the database.

All the best,
Yavor
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
kiran
Top achievements
Rank 1
answered on 26 Feb 2009, 06:05 AM
Hi Yavor
      I still have the date search problem..
     can u send me a sample demo program for the date search

thanks

0
Yavor
Telerik team
answered on 03 Mar 2009, 09:17 AM
Hi kiran,

Can you please make sure the date entered in the search is not different from the date in the database. For example,the user may me entering the date in dd/mm/yyyy format, whereas, in the database it may reside as dd/mm/yyyy hh:mm:ss format. This may be one possible reason.

Greetings,
Yavor
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
Tags
Grid
Asked by
kiran
Top achievements
Rank 1
Answers by
Yavor
Telerik team
kiran
Top achievements
Rank 1
Share this question
or