| radAccordion = new RadPanelBar(); |
| radAccordion.ID = "RadPanelBar1"; |
| radAccordion.Skin = RadSkin; |
| radAccordion.Width = new Unit(500, UnitType.Pixel); |
| radAccordion.ExpandMode = PanelBarExpandMode.MultipleExpandedItems; |
| radAccordion.CollapseAnimation.Type = AnimationType.Linear; |
| radAccordion.CollapseAnimation.Duration = 200; |
| radAccordion.ExpandAnimation.Type = AnimationType.Linear; |
| radAccordion.ExpandAnimation.Duration = 200; |
| radAccordion.EnableViewState = false; |
| ... |
| radAccordion.DataSource = listItems; |
| radAccordion.DataTextField = TitleField |
| radAccordion.DataFieldID = "ID"; |
| radAccordion.DataFieldParentID = GroupByField |
| radAccordion.DataBind(); |
| ... |
| radPanel = new RadAjaxPanel(); |
| radPanel.ID = "RadPanel1"; |
| radPanel.LoadingPanelID = "RadLoadingPanel1"; |
| radPanel.Controls.Add(radAccordion); |
| radLoadingPanel = new RadAjaxLoadingPanel(); |
| radLoadingPanel.ID = "RadLoadingPanel1"; |
| radLoadingPanel.Transparency = 30; |
| radLoadingPanel.BackColor = System.Drawing.Color.AliceBlue; |
| Controls.Add(radPanel); |
| Controls.Add(radLoadingPanel); |
| <telerik:GridTemplateColumn UniqueName="DetailArrow" ItemStyle-Width="250"> |
| <ItemTemplate> |
| <telerik:RadMenu ID="menuTools" runat="server" Flow="Horizontal" OnInit="menuTools_Init" OnItemClick="menuTools_Click" EnableEmbeddedSkins="true" EnableAjaxSkinRendering="true" CssClass="menuZ"> |
| <Items> |
| <telerik:RadMenuItem Value="Edit" ImageUrl="/images/Edit.png" ToolTip="Edit this criteria" /> |
| <telerik:RadMenuItem Value="Delete" ImageUrl="/images/trash.png" ToolTip="Remove this criteria" /> |
| <telerik:RadMenuItem Value="Notify" ImageUrl="/images/NotifyOff.png" ToolTip="Turn the notify on" OnLoad="NotifyMenuItem_Init" /> |
| </Items> |
| </telerik:RadMenu> |
| </ItemTemplate> |
| </telerik:GridTemplateColumn> |

Thanks and Regards,
----------------------------------------------------------
Velu
Project Delivery Manager
Phone : (+91-80) 40767777 Ext-302
Mobile: +91 9739979692
Optimus BT | Bangalore
Microsoft Certified Technology Specialist - Share Point.
I am trying to create a hierarchy grid programmatically based on a xml file. I am successful in adding three hierarchies. It seems that there is some problem in the way I added the third hierarchy because the properties (font color, bold) i applied are not showing up in third hierarchy (strangely it shows up in second hierarchy and second hierarchy is created by same code block that created third hierarchy) . Also, when I added the fourth hierarchy it throws error in 'DetailTableDataBind' because it cannot find the datakey values in the third hierarchy. The code snippet is here.
| public void GenerateGrid(RadGrid radGrid1) |
| { //loading xml file |
| chartXml = XElement.Load(FilterPath, LoadOptions.PreserveWhitespace); |
| title = chartXml.Attribute("title").Value; |
| radGrid1.MasterTableView.PageSize = 10; |
| foreach (XElement chartElement in chartXml.Elements()) |
| { |
| if (chartElement.Name.LocalName != null && chartElement.Name.LocalName == "Filters") |
| { |
| if(chartElement.Attribute("referencePath") != null) |
| referencePath = chartElement.Attribute("referencePath").Value; |
| bool topFilter = true; |
| foreach (XElement filterElement in chartElement.Elements()) |
| { |
| if (topFilter) |
| { |
| radGrid1.MasterTableView.Width = Unit.Percentage(100); |
| radGrid1.MasterTableView.BorderWidth = 2; |
| radGrid1.MasterTableView.BorderColor = System.Drawing.Color.Red; |
| if(filterElement.Attribute("name") != null) |
| radGrid1.MasterTableView.Name = filterElement.Attribute("name").Value; |
| if(filterElement.Attribute("dataKeyNames") != null) |
| radGrid1.MasterTableView.DataKeyNames = filterElement.Attribute("dataKeyNames").Value.Split(','); |
| string[] columnNames = filterElement.Attribute("columns").Value.ToString().Split(','); |
| foreach (string columnName in columnNames) |
| { |
| GridBoundColumn boundColumn = new GridBoundColumn(); |
| radGrid1.MasterTableView.Columns.Add(boundColumn); |
| boundColumn.UniqueName = columnName; |
| boundColumn.DataField = columnName; |
| boundColumn.HeaderText = columnName; |
| } |
| lastAddedDetailTable = radGrid1; |
| topFilter = false; |
| } |
| else |
| { |
| GridTableView tableView = new GridTableView(radGrid1); |
| tableView.Width = Unit.Percentage(100); |
| tableView.Font.Bold = true; |
| tableView.BorderWidth = 2; |
| tableView.BorderColor = System.Drawing.Color.Red; |
| if (filterElement.Attribute("name") != null) |
| tableView.Name = filterElement.Attribute("name").Value; |
| if (filterElement.Attribute("dataKeyNames") != null) |
| tableView.DataKeyNames = filterElement.Attribute("dataKeyNames").Value.Split(','); |
| if (lastAddedDetailTable.ID == "RadGrid1") |
| { |
| radGrid1.MasterTableView.DetailTables.Add(tableView); |
| } |
| else |
| { |
| ((GridTableView)lastAddedDetailTable).DetailTables.Add(tableView); |
| } |
| string[] columnNames = filterElement.Attribute("columns").Value.ToString().Split(','); |
| foreach (string columnName in columnNames) |
| { |
| GridBoundColumn boundColumn = new GridBoundColumn(); |
| tableView.Columns.Add(boundColumn); |
| boundColumn.UniqueName = columnName; |
| boundColumn.DataField = columnName; |
| boundColumn.HeaderText = columnName; |
| } |
| lastAddedDetailTable = tableView; |
| } |
| } |
| } |
| } |
| } |
| <?xml version="1.0" encoding="utf-8" ?> |
| <Chart title="Customer Order Details"> |
| <Filters referencePath="GetCustomerOrders1"> |
| <Filter name="Customers" dataKeyNames="CustomerId" columns = "CustomerId,CustomerName,CustomerAddres" /> |
| <Filter name="Orders" dataKeyNames="OrderId" columns = "OrderId,OrderDate,CustomerId" /> |
| <Filter name="OrderDetails" dataKeyNames="ProductId" columns = "ProductId,OrderDetailsId,UnitPrice,ProductName" /> |
| <Filter name="ProductDetails" dataKeyNames="ProductId" columns = "ProductName,ProductDesc,ProductId" /> |
| </Filters> |
| </Chart> |