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

How to display Header text for RowDetailsTemplate

10 Answers 79 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Mahendra
Top achievements
Rank 1
Mahendra asked on 01 Jun 2011, 01:45 PM
Hello,

  I have RowDetailsTemplate in RadGridView


<telerikGrid:RadGridView.RowDetailsTemplate>

           <DataTemplate>

               <TextBlock Text="{Binding Name}"></TextBlock>

             </DataTemplate>

 </telerikGrid:RadGridView.RowDetailsTemplate>

 

How can I show Header for that column.

Please give solution.

Thanks,
Mahendra

10 Answers, 1 is accepted

Sort by
0
Vanya Pavlova
Telerik team
answered on 01 Jun 2011, 01:56 PM
Hi Mahendra,

 

I am not quite sure what do you mean by "Header for that column"? May you please elaborate a little bit more about your extact settings? Do you want to create some custom text which will acts as a header witin RowDetailstemplate or maybe I am missing something? If that is the case you may create your custom layout that corresponds to your needs within the defined DataTemplate.

 

Regards,
Vanya Pavlova
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
Mahendra
Top achievements
Rank 1
answered on 01 Jun 2011, 02:09 PM
hello,
 Yes I want to create some custom text which will acts as a header witin RowDetailstemplate.
Please give custom template code for that.

Thanks,
Mahendra
0
Vanya Pavlova
Telerik team
answered on 01 Jun 2011, 02:19 PM
Hi Mahendra,

 

You may use the following DataTemplate with a static Text which will serve as a header:

<DataTemplate x:Key="rowDetailsTemplate">
        <Grid Background="Red" Height="100">
            <Grid.RowDefinitions>
                <RowDefinition Height="Auto"/>
                <RowDefinition/>
                </Grid.RowDefinitions>
                <TextBlock FontWeight="Black" FontSize="18" HorizontalAlignment="Center" Text="Header in RowDetailsTemplate"/>
                <StackPanel>
                    <TextBlock Text="{Binding EmployeeName}"/>
                        <TextBlock Text="{Binding CompanyName}"/>
                            <TextBlock Text="{Binding Email}"/>
                    </StackPanel>
            </Grid>
        </DataTemplate>

Greetings,
Vanya Pavlova
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
Mahendra
Top achievements
Rank 1
answered on 01 Jun 2011, 02:58 PM
Hello,
 I used your code in my template like below

<telerikGrid:RadGridView.RowDetailsTemplate>

 

          <DataTemplate>

 

              <Grid Background="Red" Height="100">

                  <Grid.RowDefinitions>

                          <RowDefinition Height="Auto"/>

                           <RowDefinition/>

                   </Grid.RowDefinitions>

                        

           <TextBlock FontWeight="Black" FontSize="18" HorizontalAlignment="Center" Text="Header in RowDetailsTemplate"/>

                           

             <StackPanel Height="30" Margin="10,0,0,0" Orientation="Horizontal" Width="100" HorizontalAlignment="Left" Tag="{Binding UserID}">

 

                 <StackPanel Width="20"></StackPanel>

                        <TextBlock Text="{Binding Name}" VerticalAlignment="Center"></TextBlock>

             </StackPanel>

 

                        </Grid>

                    </DataTemplate>

 

</telerikGrid:RadGridView.RowDetailsTemplate>


But it doesnt display any headerin the line that other columns header are displayed.

When I click on expand button to expand then I got the below error

Error: Unhandled Error in Silverlight Application

 

Code: 4004   

 

Category: ManagedRuntimeError      

 

Message: System.Collections.Generic.KeyNotFoundException: The given key was not present in the dictionary.

 

   at System.ThrowHelper.ThrowKeyNotFoundException()

 

   at System.Collections.Generic.Dictionary`2.get_Item(TKey key)

 

   at System.Windows.ResourceManagerWrapper.GetResourceForUri(Uri xamlUri, Type componentType)    

 

0
Vanya Pavlova
Telerik team
answered on 01 Jun 2011, 03:49 PM
Hi Mahendra,

 

I have tried to reproduce such a behavior but I was not able to. May you please try to isolate the problem in a runnable project and send it to us in a new support ticket where we can see what might be wrong?
Thus we would be able to provide you with an appropriate solution. 


Regards,
Vanya Pavlova
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
Mahendra
Top achievements
Rank 1
answered on 03 Jun 2011, 08:15 AM
Hello,

Your code works fine, it displays Header after expand .
 But i want to display header for Gridview on top side in the same line where other normal columns header get displayed. Means as Gridview displayed want to show header for first column, not after expanding item

Thanks,
Mahendra
0
Vanya Pavlova
Telerik team
answered on 03 Jun 2011, 08:24 AM
Hi Mahendra,

 

I am not quite sure that I understand your requirement correctly. May you please share with us some additional info about the desired final result? The Header property of each GridViewColumn is of type object and you may predefine in thw way you need, the mechanism is described in our online documentation. 
However I am not quite sure how this is related to the RowDetails or maybe I am missing something?


Greetings,
Vanya Pavlova
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
Mahendra
Top achievements
Rank 1
answered on 03 Jun 2011, 10:03 AM
Hello,

 Please find attached image, where i explain where do i need that header.

Thanks,
Mahendra
0
Vanya Pavlova
Telerik team
answered on 03 Jun 2011, 10:11 AM
Hello Mahendra,

 
Thank you for sharing this picture to us! Actually you are trying to place a header in a GridViewToggleRowDetailsColumn. You may do this in the same way as you can for any column, please refer to the following:

<telerik:GridViewToggleRowDetailsColumn Header="RowDetailsHeader"/>


Regards,
Vanya Pavlova
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
Mahendra
Top achievements
Rank 1
answered on 03 Jun 2011, 11:10 AM
Hello,

 Thank you very much.......It works perfectly.

Mahendra
Tags
GridView
Asked by
Mahendra
Top achievements
Rank 1
Answers by
Vanya Pavlova
Telerik team
Mahendra
Top achievements
Rank 1
Share this question
or