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

Programmatically trying to hide GridViewRows

3 Answers 47 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Johan
Top achievements
Rank 1
Johan asked on 28 Mar 2008, 02:47 PM
I have a list of items shown in a GridView. After Initialization I only want to show some, and not all of these Items. 
I do this through a function call with the components with the Items I want shown. 
My problem is how to hide the Items that I don't want shown. I can't use filtering, because it is impossible to construct a useful filtering string that singles out the objects that I have sent.
I have tried to retrieve all the GridViewRowInfo, setting their IsVisible property to false, then setting IsVisible to true to the ones I want shown. But all Views are still shown in the GridView component.
My Grid is hierarchic, has this anything to do with my items remaining visible?
 
        public void SetConfigurationGroups(Collection<ConfigurationGroup> configurationGroups, Collection<ConfigurationGroup> expandedGroups)  
        {  
            m_GridView  BeginEdit();  
            foreach (ConfigurationGroup group in m_ConfigurationGroups)  
            {  
                m_ConfiguratioGroupRow[group].IsVisible = false;  
                //m_ConfiguratioGroupRow[group].  
            }  
            foreach (ConfigurationGroup group in configurationGroups)  
            {  
                m_ConfiguratioGroupRow[group].IsVisible = true;  
            }  
            m_GridView.EndEdit();  
        }  
 

3 Answers, 1 is accepted

Sort by
0
Jack
Telerik team
answered on 28 Mar 2008, 05:38 PM
Hello Johan,

Thank you for contacting us.

The BeginEdit and EndEdit methods aren't needed in this scenario. These methods instruct the RadGridView to show and hide the editor of the current cell element.

Your code appears to be correct. If the configurationGroups collection contains the right rows, there should be no problems, when setting the IsVisible property. Please, open a support ticket and send us your application. This will allow me to find a suitable solution faster.

Do not hesitate to write me, if you have other questions.

Regards,
Jack
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
Johan
Top achievements
Rank 1
answered on 31 Mar 2008, 08:30 AM
I found what was causing the problem. After running the previously described code, I ran code adding a relationship between master and child templates. This caused all rows to become visible again. What I had to do was to run this code again after adding the relationship.
0
Jack
Telerik team
answered on 31 Mar 2008, 09:27 AM
Hi Johan,

I am glad to hear the issue is now resolved. Please, do not hesitate to contact me if you have any other questions.

Greetings,
Jack
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
Tags
GridView
Asked by
Johan
Top achievements
Rank 1
Answers by
Jack
Telerik team
Johan
Top achievements
Rank 1
Share this question
or