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

Apply filtering on template column

8 Answers 131 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Shabbir Hussain
Top achievements
Rank 1
Shabbir Hussain asked on 02 Jun 2010, 12:31 PM
How to show filtering icon on column header to filter out data in template column.
Urgent

                        <telerik:GridViewDataColumn Header="User Name" IsSortable="True" SortMemberPath="FirstName" IsFilterable="True">
                            <telerik:GridViewDataColumn.CellStyle>
                                <Style TargetType="telerik:GridViewCell">
                                    <Setter Property="Template">
                                        <Setter.Value>
                                            <ControlTemplate TargetType="telerik:GridViewCell">
                                                <Grid>
                                                    <StackPanel Orientation="Horizontal">
                                                        <TextBlock Text="{Binding Path=FirstName}"></TextBlock>
                                                        <TextBlock Text=" "></TextBlock>
                                                        <TextBlock Text="{Binding Path=LastName}"></TextBlock>
                                                    </StackPanel>
                                                </Grid>
                                            </ControlTemplate>
                                        </Setter.Value>
                                    </Setter>
                                    <Setter Property="BorderThickness" Value="0,0,1,1"/>
                                </Style>
                            </telerik:GridViewDataColumn.CellStyle>
                        </telerik:GridViewDataColumn>

8 Answers, 1 is accepted

Sort by
0
Vlad
Telerik team
answered on 02 Jun 2010, 12:33 PM
Hello,

You can set DataMemberBinding to desired property.

Regards,
Vlad
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
Shabbir Hussain
Top achievements
Rank 1
answered on 02 Jun 2010, 12:44 PM

But sir their is a problem that I am using to textblock  and I am unable to bind two column like

 

Not allowed by telerki: DataMemberBinding

 

 

="{Binding FirstName,LastName}"
Allowed by telerki: DataMemberBinding="{Binding FirstName}"
this.


Then how it's possible that I show First and Last name both and provide filter only on First Name

0
Vlad
Telerik team
answered on 02 Jun 2010, 12:55 PM
Hi,

You can still have CellTemplate and display anything you want however bind to single field. If you want some kind of complex filtering you can check this demo to know more how to create custom filter control for specific column(s).

Kind regards,
Vlad
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
Shabbir Hussain
Top achievements
Rank 1
answered on 02 Jun 2010, 01:19 PM
Do you thing that I create filter control only for one field. I think it not make sense, I don't think so.

Kindly explain how to create filter template without any extra control.
0
Shabbir Hussain
Top achievements
Rank 1
answered on 02 Jun 2010, 01:25 PM
Do you thing that I create filter control only for one field. I think it not make sense, I don't think so.

Kindly explain how to create filter template without any extra control.
0
Kevin Tran
Top achievements
Rank 1
answered on 07 Jul 2010, 07:49 AM
I too struck with the same,Did you got any solution.
0
Veselin Vasilev
Telerik team
answered on 07 Jul 2010, 08:22 AM
Hello guys,

Please check this troubleshooting article:
Cannot group, sort and filter a specific column

I believe the solution will help you.

Kind regards,
Veskoni
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Accepted
Kevin Tran
Top achievements
Rank 1
answered on 07 Jul 2010, 08:27 AM
Hey i think i Solved this issue Try this
 <telerik:GridViewDataColumn Header="User Name" IsSortable="True" DataMemberBinding="{Binding FirstName}" SortMemberPath="FirstName" IsFilterable="True"
                    <telerik:GridViewDataColumn.CellStyle> 
                        <Style TargetType="telerik:GridViewCell"
                            <Setter Property="Template"
                                <Setter.Value> 
                                    <ControlTemplate TargetType="telerik:GridViewCell"
                                        <Grid> 
                                            <StackPanel Orientation="Horizontal"
                                                <TextBlock Text="{Binding Path=FirstName}"></TextBlock> 
                                                <TextBlock Text=" "></TextBlock> 
                                                <TextBlock Text="{Binding Path=LastName}"></TextBlock> 
                                            </StackPanel> 
                                        </Grid> 
                                    </ControlTemplate> 
                                </Setter.Value> 
                            </Setter> 
                            <Setter Property="BorderThickness" Value="0,0,1,1"/> 
                        </Style> 
                    </telerik:GridViewDataColumn.CellStyle> 
                </telerik:GridViewDataColumn> 

Tags
GridView
Asked by
Shabbir Hussain
Top achievements
Rank 1
Answers by
Vlad
Telerik team
Shabbir Hussain
Top achievements
Rank 1
Kevin Tran
Top achievements
Rank 1
Veselin Vasilev
Telerik team
Share this question
or