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

RadGridView, Row automatically collapse

8 Answers 238 Views
GridView
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Sajjad Shah
Top achievements
Rank 1
Sajjad Shah asked on 11 Nov 2010, 08:04 PM
I have  a grid view with grouped data. My top level group is a hyperlink button. everytime i click on that the whole group collapses. How can I stop it from happening. I actually dont want it do anything. I am actually doing some other task when that link is clicked. 
Also, It only happens once (first time)..Any ideas...? how can i freeze grid not to collapse/uncollapse.

Look at unlicked and then clicked picture attached./

8 Answers, 1 is accepted

Sort by
0
Maya
Telerik team
answered on 12 Nov 2010, 11:16 AM
Hi Sajjad Shah,

I have tried to reproduce your problem, but I was not able to. I tested it with the following settings:

<telerik:RadGridView.GroupHeaderTemplate>
    <DataTemplate>
        <HyperlinkButton Content="{Binding Header}" Click="HyperlinkButton_Click"/>
    </DataTemplate>
</telerik:RadGridView.GroupHeaderTemplate>

private void HyperlinkButton_Click(object sender, RoutedEventArgs e)
        {
            HyperlinkButton hyperlinkButton = e.OriginalSource as HyperlinkButton;
            GridViewGroupRow groupRow = hyperlinkButton.ParentOfType<GridViewGroupRow>();
            if(groupRow != null)
            {
                //implement the custom logic.
            }          
        }

In this case, when the Hyperlink button is clicked, nothing happens - the group is neither collapsed, nor expanded.

Regards,
Maya
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
Sajjad Shah
Top achievements
Rank 1
answered on 12 Nov 2010, 04:33 PM
Have you set the itemsource in the code behind ? Because that's what I am doing...
more closely when I click on the link
This gets called and I dont see anything in the stack trace as where is that getting called from.

private

 

 

void RadGridView1_RowLoaded(object sender, RowLoadedEventArgs e)

 



I have this handler because I am acheveing other task here..? 
0
Maya
Telerik team
answered on 12 Nov 2010, 05:26 PM
Hi Sajjad Shah,

 I am sending you the sample project I used for testing the issue. You may feel free to change it in the way you want and use it as a reference.

Best wishes,
Maya
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
Sajjad Shah
Top achievements
Rank 1
answered on 12 Nov 2010, 05:28 PM
Hello Maya,
I have recreated it and I can tell you exactly when it happens...

I have used your solution from yesterday ..called: DoubleClockOnRow_ColorRow
( I UPGRADED IT TO VERSION: 2010.2.924.1040)

I added the hyperlink column code which you posted on this thread.

<

 

 

telerik:RadGridView Name="playersGrid" RowLoaded="RadGridView1_RowLoaded" AutoGenerateColumns="False" ItemsSource="{Binding Players}">

 

<telerik:RadGridView.GroupHeaderTemplate>

 

<DataTemplate>  

 

 

<HyperlinkButton Content="{Binding Group.Key}" Click="HyperlinkButton_Click"/> 

 

</DataTemplate> </telerik:RadGridView.GroupHeaderTemplate>

 

 

<telerik:RadGridView.Columns>

 

 

<telerik:GridViewDataColumn DataMemberBinding="{Binding Country}"/> <telerik:GridViewDataColumn DataMemberBinding="{Binding Name}"/><telerik:GridViewDataColumn DataMemberBinding="{Binding Number}"/> <telerik:GridViewDataColumn DataMemberBinding="{Binding Position}"/> </telerik:RadGridView.Columns></telerik:RadGridView>


Now run the solution

Group it by Country.
DO NOT CLICK ON ANY OF THE HYPERLINK JUST YET.

Click on 'Do somthing 1' button at the bottom of the page: this is effectively drwaing the focus away...
Now click on any link. The first group will collapse.

It only happens when the project runs first time or (not relevant here: Page with each index change)...

Also niticed: If I tried to get the focus forcefully to the grid by doing this grid.focus() on 'Do somthing 1's click event. It collapses first group.
Please advise a work around.

0
Maya
Telerik team
answered on 16 Nov 2010, 06:19 PM
Hi Sajjad Shah,

I am a bit confused here. I have run the sample project attached previously, grouped the playersGrid on the Country column, clicked on the button and then on the hyperlink button. Is that the right consequence of actions ? If so, as it is expected, the groups are collapsed on their creation, so even if I click on a button or not, there are still in the same state. Am I missing something from your requirements ?
 

All the best,
Maya
the Telerik team
See What's New in RadControls for Silverlight in Q3 2010 on Tuesday, November 16, 2010 11:00 AM - 12:00 PM EST or 10:00 PM - 11:00 PM EST: Register here>>
0
Sajjad Shah
Top achievements
Rank 1
answered on 17 Nov 2010, 04:46 PM
Maya,
Im my last post I wanted to use the word 'expand' instead of 'collapse'. I am sorry. I hope my problem makes sense now.
0
Sajjad Shah
Top achievements
Rank 1
answered on 17 Nov 2010, 08:51 PM
Maya,
I have submitted the ticket =367870 as I cant send you a zipped file.

You need to run it and group it by country
then click on first hyperlink and it expands the group for no reason

ALSO,
you can run the project
group it by country
Now, click this button at the bottom left corner called "Do something 1" and it expands the grid.

i cant make it any cleraren than this. This bug has caused a huge problem in our go-live project and it is extremly urgent. Please advise ASAP.
0
Maya
Telerik team
answered on 18 Nov 2010, 04:45 PM
Hello Sajjad Shah,

I have tried to reproduce the issues you specified. I was not able to reproduce the first one - the one with clicking on the HyperlinkButton and opening the first group. The second one - clicking on the "Do something 1" and expanding the button - is easily reproducible. However, this is by design as when the Focus() is called for the grid, it looks for a element to focus on. Consequently, it opens up the first group so that to focus the first item.
 

Best wishes,
Maya
the Telerik team
Browse the videos here>> to help you get started with RadControls for Silverlight
Tags
GridView
Asked by
Sajjad Shah
Top achievements
Rank 1
Answers by
Maya
Telerik team
Sajjad Shah
Top achievements
Rank 1
Share this question
or