I have a Web Data Tree set up like so:
<ig:WebDataTree ID="webDataTree1" runat="server" OnNodeClick="webDataTree1_NodeClick" Font-Size="Smaller" AutoPostBackFlags-NodeClick="On"></ig:WebDataTree>
The web data tree resides inside a web explorer bar. Each node of the explorer bar has a web data tree inside of it. I didn't design it this way - I'm upgrading from an old system that used the web list bar to hold web data trees.
The code that handles the NodeClick looks like this:
protected void webDataTree1_NodeClick(object sender, DataTreeNodeClickEventArgs e) { try { if (!e.Node.HasChildren) { string[] tableDetail; //tableDetail = e.Node.DataKey.ToString().Split('|'); 16 Feb 2015 EMF tableDetail = e.Node.Key.ToString().Split('|'); object[] getFilter = new object[5]; getFilter[0] = Int32.Parse(tableDetail[0].ToString()); getFilter[1] = tableDetail[1]; getFilter[2] = tableDetail[2]; getFilter[3] = e.Node.Text; getFilter[4] = tableDetail[3]; _delLoadFilterpage.DynamicInvoke(getFilter); } }
// .. catch code is here & the end of the method.
There are two scenarios that happen here.
The first time I click on a node in the web data tree, the nodeclick event does not fire. However, all of the nodes within the web explorer bar get moved down into other nodes. For example, the first three items (which start off in the first menu) wind up in the second menu, the first and third menus are blank, then the fourth holds the contents of the second menu, and so on.
The second time I click on a node, it fires the NodeClick event, at which point all of the data is scrambled, none of the arguments are correct, and I wind up with an exception. Please let me know what other information you need, thanks!
Minor edit,
Infragistics45.Web.v14.1, Version=14.1.20141.2392
Hello,
Could you please add more details? As this is a custom approach, runnable code sample reproducing the issue will be best. Is this issue consistent or it depends on the environment like different browsers for example? I am looking forward more feedback from you.
I've tried this with IE11 and Firefox 35.0.1. The other problem that I'm having (I don't remember if I've mentioned this or not) is that the first time I click the onclick event does not fire; that is when the menu options shift downward. The second time I click, the onclick event fires twice. The code is fairly complex, because the menu is populated using a dataset that is then programmatically added to the data tree. Here is the code that adds the data to the tree:
this.webDataTree1 = (WebDataTree)this.FindControl("webDataTree1"); foreach (DataRow level2DataRow in menuDS.Tables["Menu2"].Rows) // Top Level { DataTreeNode n = new DataTreeNode(); n.Text = (string)level2DataRow.ItemArray[1]; // [1] = Item name n.Key = (string)level2DataRow.ItemArray[2]; // [2] = Item ID webDataTree1.Nodes.Add(n); foreach (DataRow level3DataRow in menuDS.Tables["Menu3"].Rows) // Child Level { DataTreeNode nChild = new DataTreeNode(); int menuLevel3ParentIndex = (int)level3DataRow.ItemArray[3]; // [3] = Parent ID if (menuLevel3ParentIndex == (int)level2DataRow.ItemArray[0]) // [0] = ID { nChild.Text = (string)level3DataRow.ItemArray[1]; nChild.Key = (string)level3DataRow.ItemArray[2]; n.Nodes.Add(nChild); foreach (DataRow level4DataRow in menuDS.Tables["Menu4"].Rows) // Lowest level permitted w/ database schema { DataTreeNode nGrandChild = new DataTreeNode(); int menuLevel4ParentIndex = (int)level4DataRow.ItemArray[3]; if (menuLevel4ParentIndex == (int)level3DataRow.ItemArray[0]) { nGrandChild.Text = (string)level4DataRow.ItemArray[1]; nGrandChild.Key = (string)level4DataRow.ItemArray[2]; nChild.Nodes.Add(nGrandChild); } } } } }
Here is the code that adds the trees to the web explorer bar:
DataSet ds = business_process_layer_object.GetMenuGroup(Context.User.Identity.Name.ToString()); if(ds.Tables[0].Rows.Count > 0) { int i = 0; foreach (DataRow dr in ds.Tables[0].Rows ) { Infragistics.Web.UI.NavigationControls.ExplorerBarGroup grp = new Infragistics.Web.UI.NavigationControls.ExplorerBarGroup(); grp.Text = dr[0].ToString(); grp.Value = dr[0].ToString(); WebExpBar1.Groups.Add(grp); ExplorerBarItem item = new ExplorerBarItem(); item.TemplateId = "Template1"; item.Value = grp.Text; WebExpBar1.Groups[i].Items.Add(item); i++; } }
I don't have a dumbed down version of the code that would make this easy to reproduce, I'm hoping that you can look at my code and say, "oh, here is the problem, you haven't set this or you're assigning this incorrectly."
Here is the markup that puts the explorer bar into place in the overall aspx page:
<ig:WebExplorerBar ID="WebExpBar1" runat="server" EnableSelection="false" TabIndex="-1" BackColor="Transparent" BorderStyle="None" GroupExpandBehavior="SingleExpanded" AnimationDuration="200" AnimationEquationType="Linear" Font-Size="Small"> <Templates> <ig:ItemTemplate runat="server" ID="WebExpBar1Template1" TemplateID="Template1"> <Template> <uc1:uctree ID="uctree" Visible="true" runat="server"></uc1:uctree> </Template> </ig:ItemTemplate> </Templates> </ig:WebExplorerBar>
Let me know if that is enough info for you! You may have a data source that can stand in for the one I'm using, because I don't think I can send out the data and the data processing logic we're using to populate.
Without runnable code sample to debug, I could not tell what the cause of this behavior is on top of my head. However, we could further narrow this down. I have created a CodeSample using the approach from the code shared and yet, I could not reproduce this. I have tested this in both IE and Mozilla browsers with the same v14.1.20141.2392. I have logged the ServerSide Events order of firing into the output window in VS. Using similar approach we could find what is the exact order of events firing in your application as well.
Not firing OnNodeClick seems could be related to the WebExplorerBar events and how they are handled. Are there any event handlers attached for it? I could not see any WebExplorerBar event handlers in the code shared. For example when the first time a node from the templated tree is clicked, and the text/nodes messed up what is the event firing?
What is the event when the WebExplorerBar groups and items are populated in? What are all of the PostBack/ServerSide event handlers used? What are all AutoPostBackFlags/setting used? These are also related.
I am attaching the code sample used trying to replicate this. I suggest you test it on your side and see if you could modify it to match your case. Trying to replicate the approach in code will best answer most of the questions.
In case you would prefer to create a new one/or attach the logic privately, I could create a private case for you where the samples could be exchanged in private.I am looking forward feedback from you.
OK, I downloaded your code sample. I'm curious, do you run your code before you post it? The reason I ask is because I had to add the following line in order to get it to compile:
WebExplorerBar WebExplorerBar2 = new WebExplorerBar();
Once I did that, it would run. And it would display the "WebExplorerBar using Markup ExplorerBarGroups" but displayed nothing in the "WebExplorerBar using ServerSide DataTable DS for ExplorerBarGroups.
I have a screenshot of the results but my company is particular about accessing file sharing services (i.e., they block all of them). I can send you the file and you can post it, or just take a look. Basically everything below the second heading (ServerSide DataTable DS) is blank.
What have I missed here? Let me know, thanks!
Hello Edward,
It is a common practice to test the sample before making it public. What is more, this sample works as expected and WebExplorerBar2 is defined via the markup so there is no need to add it ServerSide. Both WebExplorerBar1 and WebExplorerBar2 are correctly rendering. I suggest you to download a new fresh copy of the sample and take a look at it.
I understand you could prefer to share more details privately, so I have created a private case CAS-153402-W3J6Y5. We could continue our discussion via the case. You could find details for your current support activity at: https://es.infragistics.com/my-account/support-activity
Thank you! I tried it again today and it compiled and ran fine.
I'm going to try reorganizing some of the code and will get back to you with the results. The whole application has thousands and thousands of lines of code and markup and it's difficult for me to pare all of it down to the basics of what I'm trying to accomplish.
The one thing that makes your code example significantly different from mine is that, while you add the web explorer bar nodes programmatically, the web data tree nodes are created using the HTML markup. So it's not as close as to my case as I would like it to be. If I can't get the program to work today, I may try to make your example more like my own and see if I can get that to fail.
Thank you for your help and I will let you know how it goes...
Thank you for the feedback. Please feel free to contact me via the private case if you require further assistance.