I have web part which displays items from any view. I’m displaying it through:
protected override void RenderContents(HtmlTextWriter writer)
{
String res = "";
SPView def = list.Views[_ViewName];
res = def.RenderAsHtml();
writer.write(res);
}
How can I display ungrouped items if they grouped in view?
This is how it should look:

You need to get the view’s
Queryproperty, then remove the<GroupBy>element. In most cases you’re probably OK doing this with a regular expressionbut in more complicated cases you might need to use a proper XML manipulator.
What I’m unsure of here is whether
RenderAsHtmlrequires you to callUpdateon the view in order for the changes to be reflected. Obviously you don’t want to do that because it’ll affect the view permanently.