|
Rank: Newbie Groups: Member
Joined: 5/8/2011 Posts: 3
|
Hi I'm using tree node and I want to binding data from DB . I read in the documentation , I found that I can populate data from DataTable or DataSet,..., but I don't now how can I populate data from DB.
thanks a lot.
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,194
|
Hi,
You would populate your DataTabe or DataSet from DB, then populate TreeView from DataTable or DataSet. It's a two step process. The first step is .NET and has nothing to do with us.
Thanks
|
|
Rank: Member Groups: Member
Joined: 4/15/2011 Posts: 19
|
I made a populateondemand treeview.
When i press on plus sign everythink works good, but if i mouseclick on the name of node, this treenode calls the populateondemand more than 1 time, and at the end of procedure i got this warning message:
EO.Web Controls Client Side Debug Message:
An error occured while applying the new output. Error message: 'parentnode' is null or not an object
You can turn off this messagge by setting EO.Web.Runtime.DebugLevel to 0 (Not recommended for debug build).
What can i do?
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,194
|
Hi,
If you have the TreeView's RaisesServerEvent set to true, then it is normal that PopulateOnDemand to be called more than once when you click the node text. The reason is it needs to re-builds all child nodes that were previously dynamically created through populate on demand. Because this is the normal behavior, so it should not cause any Javascript error.
We do not know why it causes the Javascript error for you. So you may want to try to isolate the problem into a test page ---- trying to remove all other contents, including master page step by step from your page and see which part triggered the error. If you have a page that can reproduce the error, you can send it to us and we will be happy to take a look for you. Please make sure the test page contains only code needed to reproduce the problem and also runs independently in that case.
Thanks!
|
|
Rank: Member Groups: Member
Joined: 4/15/2011 Posts: 19
|
Deleting all parts of asp.net for isolate the problem i found the problem: it happens if i put the treeview inside an update panel:
Code: HTML/ASPX
<asp:UpdatePanel ID="UpdatePanel1" runat="server" >
<ContentTemplate>
<eo:TreeView .... ></eo:TreeView>
</ContentTemplate>
</asp:UpdatePanel>
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,194
|
Hi, Great. Thanks for the info. We will investigate and see what we can find. In the mean time, try to use our CallbackPanel. Our CallbackPanel is very similar to UpdatePanel but it knows our own controls so it should work better with our controls. The code will be slightly different for our CallbackPanel:
Code: HTML/ASPX
<eo:CallbackPanel runat="server"
id="CallbackPanel1" ChildrenAsTrigger="true">
<eo:TreeView ....></eo:TreeView>
</eo:CallbackPanel>
The key differences are: 1. By default we do not enable children controls as trigger. So you need to set ChildrenAsTrigger to true. Alternatively, you can also explicitly set the CallbackPanel's Triggers property; 2. We do not have ContentTemplate. The contents of the CallbackPanel are used as ContentTemplate; Please let us know if this works for you. Thanks!
|
|
Rank: Member Groups: Member
Joined: 4/15/2011 Posts: 19
|
I have now this problem: I have the treeview inside a splitter pane:
Code: HTML/ASPX
<eo:Splitter ID="Splitter" runat="server" >
<eo:SplitterPane ID="TreePane" runat="server">
<eo:TreeView ... ></eo:TreeView>
</eo:SplitterPane>
<eo:SplitterPane ID="ContentPane" runat="server">
....
</eo:SplitterPane>
</eo:Splitter>
where should i put the callback panel? I tried in this way:
Code: HTML/ASPX
<eo:CallbackPanel runat="server" id="CallbackPanel1"
ChildrenAsTrigger="true">
<eo:Splitter ID="Splitter" runat="server" >
<eo:SplitterPane ID="TreePane" runat="server">
<eo:TreeView ... ></eo:TreeView>
</eo:SplitterPane>
<eo:SplitterPane ID="ContentPane" runat="server">
....
</eo:SplitterPane>
</eo:Splitter>
</eo:CallbackPanel>
But if i click on the treenode page is refreshed completely. Where i wrong?
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,194
|
Hi, The basic rule is CallbackPanel defines which part you want to refresh. For example, if you only wish to refresh the ContentPane when user clicks your node, then you should ONLY use a CallbackPanel inside your ContentPane. In that case you can modify the CallbackPanel's Triggers property to set the TreeView as a trigger. It will be something like this:
Code: HTML/ASPX
<eo:SplitterPane ID="ContentPane" runat="server">
<eo:CallbackPanel runat="server" id="CallbackPanel1"
Triggers="{ControlID:TreeView1;Parameter:}">
.......
</eo:CallbackPanel>
</eo:SplitterPane>
The key is the trigger can be anywhere inside the page, it does not have to be inside the CallbackPanel. Thanks
|
|
Rank: Member Groups: Member
Joined: 4/15/2011 Posts: 19
|
I understand what you mean, but i need another thing:
Code: C#
protected void TVPerf_ItemClick(object sender,
EO.Web.NavigationItemEventArgs e)
{
if (e.TreeNode.IsLeafNode)
//only expand node, so refresh only treePane
else
//i call another page
}
So, i want to refresh only the treepane when i click on expandible node. But if i apply this:
Code: HTML/ASPX
<eo:CallbackPanel runat="server" id="CallbackPanel1"
ChildrenAsTrigger="true">
<eo:Splitter ID="Splitter" runat="server" >
<eo:SplitterPane ID="TreePane" runat="server">
<eo:TreeView ... ></eo:TreeView>
</eo:SplitterPane>
<eo:SplitterPane ID="ContentPane" runat="server">
....
</eo:SplitterPane>
</eo:Splitter>
</eo:CallbackPanel>
or this:
Code: HTML/ASPX
<eo:Splitter ID="Splitter" runat="server" >
<eo:SplitterPane ID="TreePane" runat="server">
<eo:CallbackPanel runat="server" id="CallbackPanel1"
ChildrenAsTrigger="true">
<eo:TreeView ... ></eo:TreeView>
</eo:SplitterPane>
</eo:CallbackPanel>
<eo:SplitterPane ID="ContentPane" runat="server">
....
</eo:SplitterPane>
</eo:Splitter>
when i click on a node with children, it causes a postback.
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,194
|
Hi,
In that case your last code is correct (putting CallbackPanel INSIDE the TreePane and then TreeView inside the CallbackPanel). We verified the code and it works as expected --- all your server side event will be fired, but only the TreeView is refreshed. So if you are seeing different result, please try to isolate the problem into a test page. Also when you provide a test page, please also explain how you can tell it is a post back but not a callback. Once we have that, we will look into it and see what's different between your code and our test code.
Thanks
|
|
Rank: Member Groups: Member
Joined: 4/15/2011 Posts: 19
|
I checked the problem. It was my mistake. Using the second code, it will not cause the postback. In fact, on page_load i've got the test "if (!IsPostBack)" and result is false. I said it was a postback, because after click on treenode all page is refreshed: the entire page becomes white for a second, and after that, everything is render again. I don't understand why with microsoft's update panel this refresh doesn't happen, but this is not a big problem. I've got another question: Before using your callbackpanel, i used this code for disable all the controls during a computation:
Code: JavaScript
var prm = Sys.WebForms.PageRequestManager.getInstance();
prm.add_initializeRequest(InitializeRequest);
prm.add_endRequest(EndRequest);
function InitializeRequest(sender, args) {
//Disables all the INPUT Controls
for (i = 0; i < document.all.tags('INPUT').length; i++) {
var io = document.all.tags('INPUT')[i];
if (io.type != 'hidden') {
io.disabled = true;
}
}
for (i = 0; i < document.all.tags('SELECT').length; i++) {
var select = document.all.tags('SELECT')[i];
if (select.type != 'hidden') {
select.disabled = true;
}
}
}
function EndRequest(sender, args) {
//Enables all the INPUT Controls
for (i = 0; i < document.all.tags('INPUT').length; i++) {
var io = document.all.tags('INPUT')[i];
if (io.type != 'hidden') {
io.disabled = false;
}
}
for (i = 0; i < document.all.tags('SELECT').length; i++) {
var select = document.all.tags('SELECT')[i];
if (select.type != 'hidden') {
select.disabled = false;
}
}
}
How can i extend this javascript to include InitializeRequest and EndRequest of your callbackpanel?
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,194
|
Hi, You would handle the CallbackPanel's ClientSideBeforeExecute and ClientSideAfterUpdate and then call your code inside those handlers. You will want to take a look of this topic if you have not used our client side interface before: http://doc.essentialobjects.com/library/1/clientapi_howto.aspxBTW: Please start a new thread for a new question in the future. Thanks
|
|
Rank: Member Groups: Member
Joined: 4/15/2011 Posts: 19
|
eo_support wrote:Hi, Great. Thanks for the info. We will investigate and see what we can find. In the mean time, try to use our CallbackPanel. Our CallbackPanel is very similar to UpdatePanel but it knows our own controls so it should work better with our controls. The code will be slightly different for our CallbackPanel:
Code: HTML/ASPX
<eo:CallbackPanel runat="server"
id="CallbackPanel1" ChildrenAsTrigger="true">
<eo:TreeView ....></eo:TreeView>
</eo:CallbackPanel>
The key differences are: 1. By default we do not enable children controls as trigger. So you need to set ChildrenAsTrigger to true. Alternatively, you can also explicitly set the CallbackPanel's Triggers property; 2. We do not have ContentTemplate. The contents of the CallbackPanel are used as ContentTemplate; Please let us know if this works for you. Thanks! I get the javascript error also if I use eo:CallbackPanel with UpdateMode="Always". So i think that the asp:UpdatePanel generates the error because UpdateMode is "Always" by default. Do you know why this error happens?
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,194
|
Hi,
They are not quite the same. We have just posted a new build that should fix the original script error with UpdatePanel. You can download the new build from our download page and see if it works for you.
If the TreeView always raises a server side event (which will be turned into an AJAX Callback by the CallbackPanel and triggers an update), then UpdateMode="Always" will have no effect unless the CallbackPanel is triggered by another CallbackPanel in the same group. This is true because even if UpdateMode is not set to "Always", the CallbackPanel will still update. So the net result is the CallbackPanel updates regardless whether UpdateMode is set to "Always".
If the TreeView does not raise a server side event, then you should NOT set the CallbackPanel's UpdateMode to "Always" while using populate on demand at the same time. The TreeView should NOT be fully updated when it is performing populate on demand (which itself a separate AJAX call). Setting UpdateMode to “Always” causing the CallbackPanel trying to reload the TreeView while the TreeView trying to populate on demand at same time and that will fail.
Thanks
|
|