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" />protected void RadGrid1_ItemCreated(object sender, Telerik.WebControls.GridItemEventArgs e) { if (e.Item is GridDataItem) { Button btn = (e.Item as GridDataItem)["TemplateColumn"].FindControl("Button1") as Button; ScriptManager1.RegisterPostBackControl(btn); } if (e.Item is GridCommandItem) { Button btncmd = (e.Item as GridCommandItem).FindControl("Button2") as Button; ScriptManager1.RegisterPostBackControl(btncmd); } }protected void ItemsGrid_ItemCommand(object sender, Telerik.Web.UI.GridCommandEventArgs e) { if (e.Item.ItemType == GridItemType.Item || e.Item.ItemType == GridItemType.AlternatingItem) { Guid candidaturaId = new Guid(ItemsGrid.MasterTableView.DataKeyValues[e.Item.ItemIndex]["ID"].ToString()); // create a new instance of ContactsManager with default provider CandidatureManager cm = new CandidatureManager(); // get the desired candidatura and set the values of the form ICandidatura candidatura = cm.GetCandidatura(candidaturaId); string ext = Path.GetExtension(candidatura.AllegatoFilename).ToLower(); CustomDownload cd = new CustomDownload { Filename = candidatura.AllegatoFilename, MimeType = (ext == ".pdf") ? MediaTypeNames.Application.Pdf : "application/unknown", Data = candidatura.Allegato.ToArray(), }; ScriptManager sm = (ScriptManager)Page.FindControl("TheScriptManager"); Response.ClearHeaders(); Response.ClearContent(); Response.AddHeader("Accept-Ranges", cd.Data.Length.ToString()); Response.AddHeader("Content-Disposition", "attachment;filename=" + cd.Filename); Response.ContentType = cd.MimeType; if (cd.Data.Length > 0) Response.BinaryWrite(cd.Data); Response.End(); } }