or
protected void BuildOptions(GridEditFormItem editFormItem){ RadComboBox dd_RptID = (RadComboBox)editFormItem.FindControl("dd_RptID"); EISDataContext db = new EISDataContext(); // get the unique report options for the current selected report so we can render the correct controls var q_options = (from options in db.tReportConfigs where options.RptID == dd_RptID.SelectedItem.Value select options.OptID).Distinct(); foreach (var option in q_options) { string optionType = (from options in db.tReportOptions where options.OptID == option select options.OptTyp).FirstOrDefault(); string optionName = (from options in db.tReportOptions where options.OptID == option select options.OptNm).FirstOrDefault(); // get the option values for this option var q_optionValues = from optionvalues in db.tReportConfigs where optionvalues.RptID == dd_RptID.SelectedItem.Value && optionvalues.OptID == option select optionvalues; // create a div for the option control and populate it with the correct control Panel panelContent = new Panel(); panelContent.Attributes.Add("class", "popupcontent"); if (optionType == "ComboBox") { RadComboBox combo = new RadComboBox(); combo.ID = "dd_" + option.ToString(); foreach (var optionValue in q_optionValues) { combo.Items.Add(new RadComboBoxItem(optionValue.tReportOptionValue.OptNm, optionValue.tReportOptionValue.OptVal)); } panelContent.Controls.Add(combo); } // create a div for the option title and populate it with the option name Panel panelTitle = new Panel(); panelTitle.Attributes.Add("class", "popuptitle"); Label pnlLabel = new Label(); pnlLabel.Text = optionName; panelTitle.Controls.Add(pnlLabel); // create a div for the clear control Panel panelClear = new Panel(); panelClear.Attributes.Add("class", "clear"); editFormItem.FindControl("divOptions").Controls.Add(panelTitle); editFormItem.FindControl("divOptions").Controls.Add(panelContent); editFormItem.FindControl("divOptions").Controls.Add(panelClear); }}<telerik:radtreeview id="ScopeTreeView" runat="server" checkboxes="false" multipleselect="false" allownodeediting="false" registerwithscriptmanager="false" visible="true" />