Hi, Im start learing myself the TreeView now. I like it a lot but now I have a problem that I think must be a bug.
I have done a very simple treeView to demonstrate the problem.
you can try it here:
http://dev.brightville.se/rsAdmin/TmpFmc.aspxthe code is:
Code: HTML/ASPX
<table width="100%" border="0" align="left" cellpadding="0" cellspacing="2">
<tr>
<td width="150" valign="top"><b>Tree:</b></td>
<td valign="top">
<eo:TreeView runat="server" id="TreeView1" ControlSkinID="None" Width="500px"
AllowDragDrop="True" AllowEdit="true"
OnItemRenamed="TreeView1_ItemRenamed"
OnItemMoved="TreeView1_ItemMoved"
CausesValidation="false">
<LookNodes>
<eo:TreeNode ImageUrl="00030301" DisabledStyle-CssText="background-color:transparent;border-bottom-style:none;border-left-style:none;border-right-style:none;border-top-style:none;color:Gray;padding-bottom:1px;padding-left:1px;padding-right:1px;padding-top:1px;"
CollapsedImageUrl="00030301" ItemID="_Default" NormalStyle-CssText="PADDING-RIGHT: 1px; PADDING-LEFT: 1px; PADDING-BOTTOM: 1px; COLOR: black; BORDER-TOP-STYLE: none; PADDING-TOP: 1px; BORDER-RIGHT-STYLE: none; BORDER-LEFT-STYLE: none; BACKGROUND-COLOR: transparent; BORDER-BOTTOM-STYLE: none"
ExpandedImageUrl="00030302" SelectedStyle-CssText="background-color:#316ac5;border-bottom-color:#999999;border-bottom-style:solid;border-bottom-width:1px;border-left-color:#999999;border-left-style:solid;border-left-width:1px;border-right-color:#999999;border-right-style:solid;border-right-width:1px;border-top-color:#999999;border-top-style:solid;border-top-width:1px;color:White;padding-bottom:0px;padding-left:0px;padding-right:0px;padding-top:0px;"></eo:TreeNode>
</LookNodes>
</eo:TreeView>
</td>
</tr>
<tr>
<td> </td>
<td>
<asp:Button ID="btnSaveChange" runat="server" Text="Save changes" CssClass="formObjectColored" OnClick="BtnSaveChange_Click" CausesValidation="false" />
</td>
</tr>
</table>
Code: C#
protected void Page_Load(object sender, EventArgs e)
{
if (!Page.IsPostBack)
{
ReloadMenu();
}
}
private void ReloadMenu()
{
List<ForumCategory> fmcList = ForumCategoryFacad.GetForumCategoryList();
DataSet mainDs = CreateDataSet(fmcList);
// Specify the data source. Here we bind to the Menu. You
// can also bind to any sub menu.
TreeView1.DataSource = mainDs;
// Bind the "Website" column in the table to
// "NavigateUrl" property.
EO.Web.DataBinding bindingName = new EO.Web.DataBinding();
bindingName.DataField = "FolderName";
bindingName.Property = "Text-Html";
TreeView1.Bindings.Add(bindingName);
EO.Web.DataBinding bindingId = new EO.Web.DataBinding();
bindingId.DataField = "FolderId";
bindingId.Property = "ItemID";
TreeView1.Bindings.Add(bindingId);
// Populate from the data source (mainTable);
TreeView1.DataBind();
TreeView1.ExpandAll();
}
protected void TreeView1_ItemRenamed(object sender, TreeNodeRenameEventArgs e)
{
}
protected void TreeView1_ItemMoved(object sender, TreeNodeMovedEventArgs e)
{
}
protected void BtnSaveChange_Click(object sender, EventArgs e)
{
}
in the example, If I take a node that has no subnodes and drag it to where ever and then click Save change button (triggers a postback), it works great.
But when I take a node that HAS subnodes (1 or more levels) and drag it to where ever and then click the button I get a "object reference not set to an instance of an object" -error:
Code: HTML/ASPX
NullReferenceException: Objektreferensen har inte angetts till en instans av ett objekt.]
EO.Web.NavigationItem.f() +311
EO.Web.NavigationItem.f() +169
EO.Web.NavigationItem.f() +169
EO.Web.NavigationItem.f() +169
EO.Web.BaseNavigator.a(Object A_0) +23
System.Web.UI.Control.LoadViewStateRecursive(Object savedState) +186
System.Web.UI.Control.LoadChildViewStateByIndex(ArrayList childState) +136
System.Web.UI.Control.LoadViewStateRecursive(Object savedState) +224
System.Web.UI.Control.LoadChildViewStateByIndex(ArrayList childState) +136
System.Web.UI.Control.LoadViewStateRecursive(Object savedState) +224
System.Web.UI.Control.LoadChildViewStateByIndex(ArrayList childState) +136
System.Web.UI.Control.LoadViewStateRecursive(Object savedState) +224
System.Web.UI.Control.LoadChildViewStateByIndex(ArrayList childState) +136
System.Web.UI.Control.LoadViewStateRecursive(Object savedState) +224
System.Web.UI.Page.LoadAllState() +439
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1092
I must be able to drag a node with subnodes, right? so is this a bug?