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

Format Datetime, Focus Field, Create ShorCutKey for "Apply Filter" button

2 Answers 55 Views
Filter
This is a migrated thread and some comments may be shown as answers.
Le Danh
Top achievements
Rank 1
Le Danh asked on 29 Nov 2010, 09:53 AM
Now, I can't format "LastModifiedAt" column of RadFilter like as "dd/MM/yyyy hh:mm tt". I don't want to set Culture="tr-TR" Page.
Does other way  implement this format?
How to set this field focus?
How to asign ShorCutKey for "OnApplyExpressions" event?

My coding is below:
    <telerik:RadFilter ID="RadFilter1" runat="server"  OnApplyExpressions="radFilterGridControl_SearchGridData">
        <FieldEditors>
            <telerik:RadFilterDateFieldEditor FieldName="LastModifiedAt" DisplayName="LastModifiedAt" DataType="System.DateTime" />
        </FieldEditors>
    </telerik:RadFilter>
               
    <telerik:RadGrid ID="radGridControl" runat="server" AllowFilteringByColumn="True" AllowPaging="True"
         AllowSorting="True"
        GridLines="None">
        <MasterTableView AutoGenerateColumns="False"  >
            <Columns>

                <telerik:GridBoundColumn DataType="System.DateTime" DataField="LastModifiedAt" HeaderText="LastModifiedAt" >
                </telerik:GridBoundColumn>
            </Columns>
        </MasterTableView>
    </telerik:RadGrid>

Can you help me this problem?

Thanks,
Mr PhuongLD

2 Answers, 1 is accepted

Sort by
0
Daniel
Telerik team
answered on 03 Dec 2010, 02:41 PM
Hello Mr PhuongLD,

Please try the following approach:
public IEnumerable<T> ControlsOfType<T>(Control parent) where T : class
{
    foreach (Control control in parent.Controls)
    {
        if (control is T)
        {
            yield return control as T;
            continue;
        }
 
        foreach (T descendant in ControlsOfType<T>(control))
        {
            yield return descendant;
        }
    }
}
 
protected void RadFilter1_PreRender(object sender, EventArgs e)
{
    foreach (var picker in ControlsOfType<RadDateTimePicker>(sender as Control))
    {
        picker.DateInput.DateFormat = "dd/MM/yyyy";
        picker.DateInput.DisplayDateFormat = "dd/MM/yyyy";
    }
}

Let me know whether this helps.

Regards,
Daniel
the Telerik team
Browse the vast support resources we have to jumpstart your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.
0
Le Danh
Top achievements
Rank 1
answered on 29 Dec 2010, 10:09 AM
Thank you very much! This error is fixed.
Tags
Filter
Asked by
Le Danh
Top achievements
Rank 1
Answers by
Daniel
Telerik team
Le Danh
Top achievements
Rank 1
Share this question
or