or
| 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; |
| } |
| } |
| } |