| protected void rgridList_ColumnCreated(object source, Telerik.Web.UI.GridColumnCreatedEventArgs e){ |
| switch (e.Column.ColumnType) { |
| case "GridBoundColumn": |
| GridBoundColumn boundColumn = e.Column as GridBoundColumn; |
| GridTextBoxFilterTemplate lObjTextBoxFilterTemplate; |
| GridComboFilterTemplate lObjComboFilterTemplate; |
| GridSliderFilterTemplate lObjSliderFilterTemplate; |
| GridDatePickerFilterTemplate lObjRadDateTimePicker; |
| if (boundColumn.DataType == Type.GetType("System.String")){ |
| if(dtSource.DefaultView.ToTable(true, boundColumn.UniqueName).Rows.Count > WebConfig.TextBoxFilter){ |
| //To add textbox as in filter template for string columns |
| lObjTextBoxFilterTemplate = new GridTextBoxFilterTemplate(); |
| lObjTextBoxFilterTemplate.ColumnName = boundColumn.UniqueName; |
| if (htFilter[boundColumn.UniqueName] != null) |
| //To maintain existing filter value |
| lObjTextBoxFilterTemplate.FilterValue = Convert.ToString(htFilter[boundColumn.UniqueName]); |
| else |
| lObjTextBoxFilterTemplate.FilterValue = ""; |
| lObjTextBoxFilterTemplate.TableViewClientId = rgridList.MasterTableView.ClientID; |
| boundColumn.FilterTemplate = lObjTextBoxFilterTemplate; |
| } |
| else{ |
| //To add combo as in filter template for string columns |
| lObjComboFilterTemplate = new GridComboFilterTemplate(); |
| dtSource.DefaultView.Sort = boundColumn.UniqueName; |
| lObjComboFilterTemplate.DataSource = dtSource.DefaultView.ToTable(true, boundColumn.UniqueName); |
| lObjComboFilterTemplate.DataTextField = boundColumn.UniqueName; |
| lObjComboFilterTemplate.DataValueField = boundColumn.UniqueName; |
| if (htFilter[boundColumn.UniqueName] != null) |
| //To maintain existing filter value |
| lObjComboFilterTemplate.FilterValue = Convert.ToString(htFilter[boundColumn.UniqueName]);//boundColumn.CurrentFilterValue |
| lObjComboFilterTemplate.TableViewClientId = rgridList.MasterTableView.ClientID; |
| boundColumn.FilterTemplate = lObjComboFilterTemplate; |
| } |
| } |
| else if (boundColumn.DataType == Type.GetType("System.Int16") || |
| boundColumn.DataType == Type.GetType("System.Int32") || |
| boundColumn.DataType == Type.GetType("System.Int64") || |
| boundColumn.DataType == Type.GetType("System.Decimal") || |
| boundColumn.DataType == Type.GetType("System.Double")){ |
| //To add slider in filter template for numeric columns |
| lObjSliderFilterTemplate = new GridSliderFilterTemplate(); |
| lObjSliderFilterTemplate.ColumnName = boundColumn.UniqueName; |
| lObjSliderFilterTemplate.StartValue = Convert.ToInt32(Session["startSlider"]); |
| lObjSliderFilterTemplate.EndValue = Convert.ToInt32(Session["endSlider"]); |
| dtSource.DefaultView.Sort = boundColumn.HeaderText + " DESC"; |
| //DataRow dr = dtSource.Select("Max('[" + boundColumn.HeaderText + "]')")[0]; |
| lObjSliderFilterTemplate.MaxValue = Convert.ToInt32(dtSource.DefaultView[0][boundColumn.HeaderText]); |
| boundColumn.FilterTemplate = lObjSliderFilterTemplate; |
| } |
| break; |
| case "GridDateTimeColumn": |
| //To assign DataFormatString for DateTime columns |
| GridDateTimeColumn dateColumn = e.Column as GridDateTimeColumn; |
| dateColumn.DataFormatString = "{0:MM/dd/yyyy}"; |
| //To add filter template |
| lObjRadDateTimePicker = new GridDatePickerFilterTemplate(); |
| lObjRadDateTimePicker.ColumnName = dateColumn.UniqueName; |
| if (htFilter[dateColumn.UniqueName] != null) |
| //To maintain existing filter value |
| lObjRadDateTimePicker.FilterValue = Convert.ToString(htFilter[dateColumn.UniqueName]); |
| else |
| lObjRadDateTimePicker.FilterValue = ""; |
| lObjRadDateTimePicker.TableViewClientId = rgridList.MasterTableView.ClientID; |
| dateColumn.FilterTemplate = lObjRadDateTimePicker; |
| break; |
| } |
| } |
Version: 2009.3.1208.35
Dim FindNode As RadTreeNode = Me.RadTreeViewTerritories.Nodes.FindNodeByValue(46)
Comes back set to Nothing, but if I set a break point and debug the object using the Immediate Window
this is the results, it finds it. Node has 3 levels.
? RadTreeViewTerritories.Nodes.FindNodeByValue(46)
Nothing
? RadTreeViewTerritories.Nodes(0).Nodes(0).Nodes.FindNodeByValue(46) .Text
"Node 5"
Looks like it won't transverse the node tree.
What I'm doing wrong?
FYI: What I'm trying to do is rename the Node from a textbox and have it refresh (Server Side)
Thanks
John
| protected override void CreateChildControls() |
| { |
| base.CreateChildControls(); |
| try |
| { |
| da = new DataAccess(); |
| strArea = "SubSite Name"; |
| strListName = "List Name"; |
| strView = "All Documents"; |
| ds = da.GetListData(strArea, strListName, strView); |
| this.EnsureUpdatePanelFixups(); |
| UpdatePanel up = new UpdatePanel(); |
| up.ID = "UpdatePanel1"; |
| up.ChildrenAsTriggers = true; |
| up.UpdateMode = UpdatePanelUpdateMode.Conditional; |
| this.Controls.Add(up); |
| // Example of adding RadGrid to Moss 2007 site using a RadGrid |
| // ************************************************************* // |
| rdDocs = new RadGrid(); |
| rdDocs.ID = "rdDocs"; |
| rdDocs.DetailTableDataBind += new GridDetailTableDataBindEventHandler(rdDocs_DetailTableDataBind); |
| rdDocs.ItemCommand += new GridCommandEventHandler(rdDocs_ItemCommand); |
| rdDocs.ItemDataBound += new GridItemEventHandler(rdDocs_ItemDataBound); |
| rdDocs.PageSize = 30; |
| rdDocs.AllowPaging = true; |
| rdDocs.AllowSorting = true; |
| rdDocs.GridLines = GridLines.None; |
| rdDocs.ShowStatusBar = true; |
| rdDocs.PagerStyle.Mode = GridPagerMode.NumericPages; |
| rdDocs.AutoGenerateColumns = false; |
| GridBoundColumn gbcID = new GridBoundColumn(); |
| GridBoundColumn gbcLinkFileName = new GridBoundColumn(); |
| GridBoundColumn gbcPrimaryPOC = new GridBoundColumn(); |
| gbcID.DataField = "ID"; |
| gbcID.HeaderText = "Document ID"; |
| gbcID.Visible = false; |
| gbcLinkFileName.DataField = "LinkFilename"; |
| gbcLinkFileName.HeaderText = "Documents"; |
| gbcPrimaryPOC.DataField = "Primary_x0020_POC"; |
| gbcPrimaryPOC.HeaderText = "Primary POC"; |
| rdDocs.Columns.Add(gbcID); |
| rdDocs.Columns.Add(gbcLinkFileName); |
| rdDocs.Columns.Add(gbcPrimaryPOC); |
| rdDocs.Width = Unit.Percentage(95); |
| rdDocs.DataSource = ds.Tables[0]; |
| rdDocs.DataBind(); |
| up.ContentTemplateContainer.Controls.Add(rdDocs); |
| // ************************************************************* // |
| // Example of adding RadGrid to Moss 2007 site using a RadGrid |
| // ************************************************************* // |
| GridTableView rdSndPOCs = new GridTableView(); |
| GridTableViewRelation gtvrSndPOCs = new GridTableViewRelation(); |
| rdSndPOCs.ID = "rdSndPOCs"; |
| rdSndPOCs.Caption = "Secondary POCs"; |
| GridRelationFields grfSndPOCs = new GridRelationFields(); |
| grfSndPOCs.DetailKeyField = "ID"; |
| grfSndPOCs.MasterKeyField = "ID"; |
| rdDocs.MasterTableView.ParentTableRelation.Add(grfSndPOCs); |
| gtvrSndPOCs.Add(grfSndPOCs); |
| rdSndPOCs.PageSize = 30; |
| rdSndPOCs.AllowPaging = true; |
| rdSndPOCs.AllowSorting = true; |
| rdSndPOCs.GridLines = GridLines.None; |
| rdSndPOCs.PagerStyle.Mode = GridPagerMode.NumericPages; |
| rdSndPOCs.AutoGenerateColumns = false; |
| gbcID = new GridBoundColumn(); |
| GridBoundColumn gbcSecondaryPOC = new GridBoundColumn(); |
| gbcID.DataField = "ID"; |
| gbcID.HeaderText = "Document ID"; |
| gbcID.Visible = true; |
| gbcSecondaryPOC.DataField = "SecondaryPOC"; |
| gbcSecondaryPOC.HeaderText = "Secondary POC"; |
| rdSndPOCs.Columns.Add(gbcID); |
| rdSndPOCs.Columns.Add(gbcSecondaryPOC); |
| rdSndPOCs.Width = Unit.Percentage(95); |
| rdSndPOCs.DataSource = ds.Tables[1]; |
| rdSndPOCs.DataBind(); |
| rdDocs.MasterTableView.DetailTables.Add(rdSndPOCs); |
| } |
| catch (Exception ex) |
| { |
| Context.Response.Write(ex.Message); |
| } |
| } |
| void rdDocs_DetailTableDataBind(object source, GridDetailTableDataBindEventArgs e) |
| { |
| string str = ""; |
| } |
| void rdDocs_ItemDataBound(object sender, GridItemEventArgs e) |
| { |
| strTest += e.Item.ItemIndex + "<br>"; |
| } |
| void rdDocs_ItemCommand(object source, GridCommandEventArgs e) |
| { |
| //throw new NotImplementedException(); |
| if (e.CommandName == "ExpandCollapse") |
| { |
| DataTable dt = (DataTable)e.Item.OwnerTableView.DataSource; |
| if ((dt != null) && (dt.TableName == "DocTable")) |
| { |
| GridTableView detailView = (e.Item as GridDataItem).ChildItem.NestedTableViews[1]; |
| detailView.Visible = false; |
| } |
| } |
| } |
I have an ASP.NET application with several RadGrids on it displaying data, as well as some other text and images. All of the content is contained within an ASP.NET Ajax tabcontainer. The end user wants the ability to export all of the data to a PDF file, so I thought it might be a good idea to put a RadEditor on another tab, and have all of the data from the application added to the RadEditor content area, and then when the end user is ready they can make any needed changes in the RadEditor, and then use the ExportToPDF function to get the PDF.
However, I have been unable to get the data from the RadGrids into the RadEditor, can anyone give me some insight as to how I can accomplish this? I tried this:
public string RenderControl(Control ctrl)
{
StringBuilder sb = new StringBuilder();
StringWriter tw = new StringWriter(sb);
HtmlTextWriter hw = new HtmlTextWriter(tw);
ctrl.RenderControl(hw);
return sb.ToString();
}
protected void Button1_Click1(object sender, EventArgs e)
{
RadEditor1.Content += RenderControl(RadGrid1);
RadEditor1.ExportToPdf();
}
But I got some kind of script error:
Script control 'RadGrid1' is not a registered script control. Script controls must be registered using RegisterScriptControl() before calling RegisterScriptDescriptors().
Parameter name: scriptControl
Any and all input is greatly appreciated.
John.
Response.OutputStream
.
Each time I press the btnVisualizza_MG button the image must be updated. The button is enclosed in a RadAjaxManager as triggering control of the div. This is a brief extract of the code.
<
telerik:RadAjaxManagerProxy ID="RadAjaxManagerProxy1" runat="server">
<AjaxSettings>
<telerik:AjaxSetting AjaxControlID="btnVisualizza_MG">
<
UpdatedControls>
<telerik:AjaxUpdatedControl ControlID="divDisegnoModificaDisegno" LoadingPanelID="lp1" />
</UpdatedControls>
</telerik:AjaxSetting>
<AjaxSettings>
</telerik:RadAjaxManagerProxy >
protected
void btnVisualizza_MG_Click(object sender, EventArgs e)
{
divDisegnoModificaDisegno.Controls.Clear();
System.Web.UI.HtmlControls.
HtmlImage image = new System.Web.UI.HtmlControls.HtmlImage();
image.Src =
"DrawGeometriaSistema.aspx?dim_x=640&dim_y=609";
divDisegnoModificaDisegno.Controls.Add(image);
}
THE PROBLEM: the first time I press the btnVisualizza_MG button, the DrawGeometriaSistema.aspx page is called and the image is generated but the following times the image remains unchanged since the code, when reaching "image.Scr=..." instruction, does not call the DrawGeometriaSistema.aspx page.
Why and how to solve this problem?