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

Filter Width in RadGrid's GridBoundColumn

5 Answers 844 Views
Grid
This is a migrated thread and some comments may be shown as answers.
J-F
Top achievements
Rank 1
J-F asked on 21 Jan 2010, 01:59 AM
Hi,

I'm using Filtering option in a RadGrid. All is working fine but I cannot change the width value of the Filter control.
I try to change the width control of a GridBoundColumn but there are not available properties to do it.

How can I change Width of Filter control?

J-F Delisle

5 Answers, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 1
answered on 21 Jan 2010, 03:58 AM
Hi,

Check out the following help document which should provide you with the necessary information to change the appearance of the items in the filtering item:
Setting filter textbox dimensions/changing default filter image

Thanks
Princy.
0
Txarlie
Top achievements
Rank 1
answered on 01 Feb 2013, 09:49 AM
I'm afraid there is a problem with this snippet. The first time the event is triggered, the GridFilteringItem is rendered correctly. But after filtering any value, the GridFilteringItem recovers its wrong width. 

Am I doing something wrong? What do I need to configure to render the correct width always? 

Thanks in advance. Regards, 

0
Princy
Top achievements
Rank 1
answered on 01 Feb 2013, 10:57 AM
Hi,

Unfortunately i couldn't replicate the issue. Please take look into the sample code snippet I tried.

ASPX:
<telerik:RadGrid ID="RadGrid1" DataSourceID="SqlDataSource1" AutoGenerateColumns="false"
    AllowFilteringByColumn="true" runat="server OnItemCreated="RadGrid1_ItemCreated">
    <MasterTableView CommandItemDisplay="Top">
        <Columns>
            <telerik:GridBoundColumn DataField="OrderID" AllowFiltering="true">
            </telerik:GridBoundColumn>
            <telerik:GridCheckBoxColumn DataField="IsTrue" AllowFiltering="true">
            </telerik:GridCheckBoxColumn>
        </Columns>
    </MasterTableView>
</telerik:RadGrid>

C#:
protected void RadGrid1_ItemCreated(object sender, GridItemEventArgs e)
{
    if (e.Item is GridFilteringItem)
    {
        GridFilteringItem filteringItem = e.Item as GridFilteringItem;
        //set dimensions for the filter textbox 
        TextBox box = filteringItem["OrderID"].Controls[0] as TextBox;
        box.Width = Unit.Pixel(30);
    }
}

Please provide your complete code to replicate the problem.

Thanks,
Princy.
0
Matt
Top achievements
Rank 1
answered on 18 Nov 2013, 04:41 PM

I can't replicate the example. You would think that this could be set in the markup...

protected void ItemCreated(object sender, GridItemEventArgs e)
        {
            if (e.Item is GridFilteringItem)
            {
                GridFilteringItem gridFilteringItem = e.Item as GridFilteringItem;
                TextBox completed = gridFilteringItem["CompleteDate"].Controls[0] as TextBox;
                completed.Width = Unit.Pixel(50);
            }
        }

<telerik:RadGrid ID="RG_Assignments" runat="server" AllowFilteringByColumn="True" AllowPaging="True" AllowSorting="True" AutoGenerateColumns="False" CellSpacing="0" GridLines="None" OnItemCreated="ItemCreated" PageSize="100" style="margin:10px">
    <ExportSettings HideStructureColumns="true" ExportOnlyData="true" IgnorePaging="false" OpenInNewWindow="true" Excel-Format="Html" Excel-FileExtension="xls" FileName="Guidelines">
        <Excel Format="Html" />
    </ExportSettings>
    <ClientSettings EnableRowHoverStyle="true">
        <ClientEvents OnRowDblClick="RowDblClick" />
    </ClientSettings>
<MasterTableView ClientDataKeyNames="uid">
    <CommandItemSettings ShowAddNewRecordButton="false" ShowExportToExcelButton="true"></CommandItemSettings>
    <RowIndicatorColumn Visible="True" FilterControlAltText="Filter RowIndicator column"/>
    <PagerStyle PageSizeControlType="RadComboBox"></PagerStyle>
    <Columns>
        <telerik:GridBoundColumn HeaderText="Region" DataField="region" ItemStyle-HorizontalAlign="Left" SortExpression="region" UniqueName="region"/>
        <telerik:GridBoundColumn HeaderText="Area" DataField="area" ItemStyle-HorizontalAlign="Left" SortExpression="area" UniqueName="area"/>
        <telerik:GridBoundColumn HeaderText="Market" DataField="market" ItemStyle-HorizontalAlign="Left" SortExpression="market" UniqueName="market"/>
        <telerik:GridBoundColumn HeaderText="Banking Center" DataField="bc" ItemStyle-HorizontalAlign="Left" SortExpression="bc" UniqueName="bc"/>
        <telerik:GridBoundColumn HeaderText="Co/CC" DataField="CoCC" SortExpression="cocc" UniqueName="CoCC"/>
        <telerik:GridBoundColumn HeaderText="Queue" DataField="QueueType" SortExpression="QueueType" UniqueName="Queue"/>
        <telerik:GridBoundColumn HeaderText="Core" DataField="CoreScheduler" SortExpression="CoreScheduler" UniqueName="Core"/>
        <telerik:GridBoundColumn HeaderText="Scheduler" DataField="Scheduler" SortExpression="Scheduler" UniqueName="Scheduler"/>
        <telerik:GridDateTimeColumn HeaderText="Completed" DataField="CompleteDate" SortExpression="CompleteDate" DataFormatString="{0:d}" ItemStyle-HorizontalAlign="Center" UniqueName="CompleteDate"/>
        <telerik:GridBoundColumn HeaderText="QCer" DataField="QCer" SortExpression="QCer" ItemStyle-HorizontalAlign="Left" UniqueName="QCer"/>
        <telerik:GridDateTimeColumn HeaderText="Reviewed" DataField="ReviewedDate" SortExpression="ReviewedDate"  DataFormatString="{0:d}" ItemStyle-HorizontalAlign="Center" UniqueName="ReviewedDate"/>
        <telerik:GridDateTimeColumn HeaderText="Finalized" DataField="FinalizedDate" SortExpression="FinalizedDate"  DataFormatString="{0:d}" ItemStyle-HorizontalAlign="Center" UniqueName="FinalizedDate"/>
        <telerik:GridDateTimeColumn HeaderText="Altered" DataField="BCAlteredDate" SortExpression="BCAlteredDate"  DataFormatString="{0:d}" ItemStyle-HorizontalAlign="Center" UniqueName="BCAlteredDate"/>
        <telerik:GridDateTimeColumn HeaderText="Returned" DataField="ReturnDate" SortExpression="ReturnDate"  DataFormatString="{0:d}" ItemStyle-HorizontalAlign="Center" UniqueName="ReturnDate"/>
        <telerik:GridDateTimeColumn HeaderText="1st Attempt" DataField="BCContact1" SortExpression="BCContact1"  DataFormatString="{0:d}" ItemStyle-HorizontalAlign="Center" UniqueName="BCContact1"/>
        <telerik:GridDateTimeColumn HeaderText="2nd Attempt" DataField="BCContact2" SortExpression="BCContact2"  DataFormatString="{0:d}" ItemStyle-HorizontalAlign="Center" UniqueName="BCContact2"/>
        <telerik:GridDateTimeColumn HeaderText="No Response" DataField="BCContact3" SortExpression="BCContact3"  DataFormatString="{0:d}" ItemStyle-HorizontalAlign="Center" UniqueName="BCContact3"/>
    </Columns>
    <NoRecordsTemplate>



0
Princy
Top achievements
Rank 1
answered on 19 Nov 2013, 04:13 AM
Hi Matt,

I'm not clear about your requirement. If you want to set the TextBox width of the FilterControl, you can set it in the aspx using the property FilterControlWidth as follows:

ASPX:
<telerik:GridDateTimeColumn DataField="CompleteDate" HeaderText="Complete Date" UniqueName="CompleteDate"
 FilterControlWidth="100px" PickerType="DatePicker">
</telerik:GridDateTimeColumn>

Thanks,
Princy
Tags
Grid
Asked by
J-F
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 1
Txarlie
Top achievements
Rank 1
Matt
Top achievements
Rank 1
Share this question
or