Forum  General Visual ...  How do I...?  ListView Group Unstable
Previous Previous
 
Next Next
New Post 3/2/2010 12:30 AM
Unresolved
  mhensen
203 posts
www.webvize.nl
4th Level Poster




ListView Group Unstable 

I have quite some trouble with the Listview grouping.. I can't figure out what makes it tick!!

In a UserControl on form A it works but on form B it doesn't. 
Checking the ListView.Group[x] it says .. x listviewitems but they don't show as a group..

So to anyone. what makes the grouping tick!!! or how to force it render as a group..


With kind regards,

Michael Hensen

VWG Community Frameworks
 
New Post 3/2/2010 1:17 AM
  rudicronje
92 posts
www.ofisys.co.za
No Ranking


Re: ListView Group Unstable 
Modified By rudicronje  on 3/2/2010 5:24:47 AM)

 Hi,

Below is a function i use for grouping listviews and it works pretty well for me, this function is applied after the listview has been polulated.

 

hope this helps,

Rudi

 

public static void GroupListView(ListView lvw, Int32 GroupByColumn)
{
try
{
    lvw.Columns[GroupByColumn].Visible = false;
    string header = lvw.Items[0].SubItems[GroupByColumn].Text;
    ListViewGroup grp = new ListViewGroup(header, HorizontalAlignment.Right);
    lvw.Groups.Add(grp);
     lvw.Items[0].Group = grp;


foreach (ListViewItem itm in lvw.Items)
{
    if (header != itm.SubItems[GroupByColumn].Text)
    {
         header = itm.SubItems[GroupByColumn].Text;
         grp = new ListViewGroup(itm.SubItems[GroupByColumn].Text, HorizontalAlignment.Right);
         lvw.Groups.Add(grp);
         itm.Group = grp;
}
else
{
       itm.Group = grp;
}
}
}
catch
{

}
}

 

 

 

 
New Post 3/2/2010 1:50 AM
  mhensen
203 posts
www.webvize.nl
4th Level Poster




Re: ListView Group Unstable 
Modified By mhensen  on 3/2/2010 5:51:20 AM)

 That's nearly the same as I am doing .. First bind and then add the groups.. Add the items to the groups.

I can see in the debugger that the listview contains groups.. and that each group contains listviewitems.. and that the group is named.

But the only show me 
'defalut"  <- no typo.. this is a typo from within VWG !!!

one thing I notice but not sure if this is by design is that the Group.Listview=null;


Once it shows, and on another instance it won't..


With kind regards,

Michael Hensen

VWG Community Frameworks
 
New Post 3/2/2010 3:35 AM
  mhensen
203 posts
www.webvize.nl
4th Level Poster




Re: ListView Group Unstable 

 Another think to notice is that added controls are not displayed also..
Jast the raw data as binded by the datasource..

This is really halting my dev... Hoping for a solution any soon!!!!


With kind regards,

Michael Hensen

VWG Community Frameworks
 
New Post 3/3/2010 5:32 AM
  mhensen
203 posts
www.webvize.nl
4th Level Poster




Re: ListView Group Unstable 

 I have been able to narrow the problem down.. 


 
As I do need to add tabs dynamicly to a tabcontrol I do so by setting up the tabs in designmode and then on start of the form I remove the tabs not needed.. As visible won't work an tabpages I remove them from the tabpage collection.!! 

When the tabs is needed I add the tab back to the control again. to make sure you can work on.

Now when that just added tab contains a treeview that uses grouping the grouping won't show....
I trried with update() but that didn't help me also.. 


With kind regards,

Michael Hensen

VWG Community Frameworks
 
Previous Previous
 
Next Next
  Forum  General Visual ...  How do I...?  ListView Group Unstable
Azure banner
.NET Web, Cloud and Mobile application delivery platform | Sitemap | Terms of Use | Privacy Statement | Copyright © 2005-2011 Visual WebGui®       Visual WebGui weblog on ASP.NET Visual WebGui Group on LinkedIn Visual WebGui updates on Twitter Visual WebGui Page on Facebook Visual WebGui YouTube Channel Visual WebGui Platform News RSS