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

Add icon to GridView GroupRow

12 Answers 93 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Subrajit
Top achievements
Rank 1
Subrajit asked on 23 Feb 2012, 03:42 PM
Hi,
  I have a GridView which is grouped based on a certain criteria. In the group row, I want to display the name (which is getting displayed) and a image which when clicked should perform a certain task. The image should also be of toggle type, which means on a certain condition I should display Active image and on certain condition I should display Inactive image.
I am able to display the image and text on the group row using Control Template, but neither am I able to add an event to the image, nor the toggle effect is showing up.
Can anyone help me in this regard?

The attached image will tell you what I want to do. The images should be displayed based on a certain condition and only one of them should display. Besides, it should be properly positioned.

Thanx,
Subrajit

12 Answers, 1 is accepted

Sort by
0
Vanya Pavlova
Telerik team
answered on 23 Feb 2012, 03:48 PM
Hello Subrajit,

 

Why not try with a GroupHeaderTemplateSelector instead? 



Regards,
Vanya Pavlova
the Telerik team
Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>
0
Subrajit
Top achievements
Rank 1
answered on 23 Feb 2012, 04:12 PM
Can you tell me how to get this done? I am actually new to using Telerik controls. Infact this is the first time I am using a Telerik Gridview.
0
Subrajit
Top achievements
Rank 1
answered on 28 Feb 2012, 07:14 PM
Any update on this?? Can anyone help me out on this?? I am really in a fix at present and need an update.
0
Vlad
Telerik team
answered on 29 Feb 2012, 08:05 AM
Hi,

 I strongly suggest you to check the demo code and let us know if you have any specific questions related to our implementation. 

All the best,
Vlad
the Telerik team
Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>
0
Subrajit
Top achievements
Rank 1
answered on 29 Feb 2012, 01:16 PM
I did check it. Unfortunately I am unable to get it. What I need is for my group header to have the group name and a toggle image displayed. Both these will come from the database. Can I get any sample application so that I can build on it?
0
Vlad
Telerik team
answered on 29 Feb 2012, 01:18 PM
Hello,

The approach will work no matter how you get your data - from data-base or memory. 

Greetings,
Vlad
the Telerik team
Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>
0
Subrajit
Top achievements
Rank 1
answered on 29 Feb 2012, 01:25 PM

This is my code snippet. The controls are not getting the data that is being retrieved from the database.

<telerik:RadGridView.GroupHeaderTemplate>
<DataTemplate>
<StackPanel Orientation="Horizontal" >
<!--<TextBlock Text="{Binding .,Converter={StaticResource gp}}"/>-->
<!--<TextBlock Text="This is it"/>-->
<TextBlock x:Name="txtName" Text="{Binding Name}"></TextBlock>
<Button x:Name="btnFlagYes" Style="{StaticResource btnStyle}" Visibility="{Binding Flag, Converter={StaticResource ShowFlag}, ConverterParameter=false}" ToolTipService.ToolTip="Flag" Tag="{Binding}" Click="btnFlag_Click" />
<Button x:Name="btnFlagNo" Visibility="{Binding Flag, Converter={StaticResource ShowFlag}, ConverterParameter=false}" Style="{StaticResource btnStyleSmall}" ToolTipService.ToolTip="Flag" Tag="{Binding}" Click="btnFlagNo_Click" />
</StackPanel>
</DataTemplate>
</telerik:RadGridView.GroupHeaderTemplate>

0
Vlad
Telerik team
answered on 29 Feb 2012, 01:31 PM
Hi,

 The DataContext here is not a data item but grid group view model. You can check also this demo to know more how to access various properties. 

Kind regards,
Vlad
the Telerik team
Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>
0
Subrajit
Top achievements
Rank 1
answered on 29 Feb 2012, 01:51 PM
I am not sure if I understand it clearly. Any example? or some code snippet to have me understand it? I know I am asking too much, but I am actually new into this and I am really stuck in this badly..
0
Vlad
Telerik team
answered on 29 Feb 2012, 01:57 PM
Hi,

 I'm not sure if I understand your question. Have you checked the code of both demos? Do you know what is DataContext?

All the best,
Vlad
the Telerik team
Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>
0
Subrajit
Top achievements
Rank 1
answered on 29 Feb 2012, 04:25 PM
Yes, I took a close look at all the samples provided. however, it doesnt solve my problem. All the GridHeader Group Template talk about have different templates to work with the Group Key. For example I can style the key itself, or I can use the Agreegate Functions to display the aggregate values. However, for me the scenario is a lot different. I have two columns coming from the database, 1. the Key and 2. is a FLag value. The Key is the one based on which I am forming the Group Row. This is working as expected. However, I need to display 2 images next to the key in the group row which will depend on the FLag value. I am unable to get this to work. Any help regarding this???Hope I am able to clear your doubts regarding the scenario I have.
0
Vlad
Telerik team
answered on 01 Mar 2012, 08:30 AM
Hello,

 Indeed that is why we've suggested you to use GroupHeaderTemplateSelector where you can return unlimited number of templates according to your scenario. To access columns data in case of grouping you should access Group.Items. 

Regards,
Vlad
the Telerik team
Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>
Tags
GridView
Asked by
Subrajit
Top achievements
Rank 1
Answers by
Vanya Pavlova
Telerik team
Subrajit
Top achievements
Rank 1
Vlad
Telerik team
Share this question
or