1protected void removeViewToolbar(ListViewWebPart wp)
2 {
3 // Extract view
4 System.Reflection.PropertyInfo ViewProp = wp.GetType().GetProperty("View", System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance);
5 SPView spView = ViewProp.GetValue(wp, null) as SPView;
6
7 // This forces a refresh of the views internal xml or the node's cild nodes are not populated
8 string txt = spView.SchemaXml;
9 System.Reflection.PropertyInfo NodeProp = spView.GetType().GetProperty("Node", System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance);
10 XmlNode node = NodeProp.GetValue(spView, null) as XmlNode;
11 XmlNode tBarNode = node.SelectSingleNode("Toolbar");
12
13 if (tBarNode != null)
14 {
15 tBarNode.Attributes["Type"].Value = "None";
16 spView.Update();
17 }
18 }