Add icon to GridView GroupRow

13 posts, 0 answers
  1. Subrajit
    Subrajit avatar
    13 posts
    Member since:
    Jan 2012

    Posted 23 Feb 2012 Link to this post

    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

  2. Vanya Pavlova
    Admin
    Vanya Pavlova avatar
    2019 posts

    Posted 23 Feb 2012 Link to this post

    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 >>
  3. Subrajit
    Subrajit avatar
    13 posts
    Member since:
    Jan 2012

    Posted 23 Feb 2012 Link to this post

    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.
  4. Subrajit
    Subrajit avatar
    13 posts
    Member since:
    Jan 2012

    Posted 28 Feb 2012 Link to this post

    Any update on this?? Can anyone help me out on this?? I am really in a fix at present and need an update.
  5. Vlad
    Admin
    Vlad avatar
    11100 posts

    Posted 29 Feb 2012 Link to this post

    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 >>
  6. Subrajit
    Subrajit avatar
    13 posts
    Member since:
    Jan 2012

    Posted 29 Feb 2012 Link to this post

    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?
  7. Vlad
    Admin
    Vlad avatar
    11100 posts

    Posted 29 Feb 2012 Link to this post

    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 >>
  8. Subrajit
    Subrajit avatar
    13 posts
    Member since:
    Jan 2012

    Posted 29 Feb 2012 Link to this post

    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>

  9. Vlad
    Admin
    Vlad avatar
    11100 posts

    Posted 29 Feb 2012 Link to this post

    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 >>
  10. Subrajit
    Subrajit avatar
    13 posts
    Member since:
    Jan 2012

    Posted 29 Feb 2012 Link to this post

    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..
  11. Vlad
    Admin
    Vlad avatar
    11100 posts

    Posted 29 Feb 2012 Link to this post

    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 >>
  12. Subrajit
    Subrajit avatar
    13 posts
    Member since:
    Jan 2012

    Posted 29 Feb 2012 Link to this post

    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.
  13. Vlad
    Admin
    Vlad avatar
    11100 posts

    Posted 01 Mar 2012 Link to this post

    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 >>
Back to Top