Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
100
Error with WebTree ManualSmartCallbacks Demand Load.
posted

Hi. 

I've got a webtree which I'm trying to populate two levels of nodes using DemandLoad with manual smart callbacks.  The top level works fine, but when I try and populate a child node, I get a Node.DataBind : treeControl parameter invalid error.  This doesn't happen after the page posts back.  I've attached code for my Demand load functions.  The child nodes are populated via the GetBrowseChildren() function. 

private void DemandLoadBrowser(Node n)

{

switch (n.DataPath)

{

case "Product":

GetBrowseProducts(n, n.Text);

n.Expanded =
true;

break;

case "Vendor":

GetBrowseVendor(n, n.Text);

n.Expanded =
true;

break;

case "Technology":

GetBrowseTechnology(n, n.Text);

n.Expanded =
true;

break;

default:

GetBrowseChildren(n);

break;

}

}

private void GetBrowseChildren(Node n)

{

string queryString;

string strNodeText = n.DataPath.Substring(3);

switch (n.DataPath.Substring(0, 2))

{

case "Ve": // "ndor":

queryString =

"SELECT p.Name, 'Product.aspx?q=' + CONVERT(varchar(10), p.ProductID) AS TargetURL FROM Vendor v INNER JOIN Product AS p ON p.VendorId = v.VendorId WHERE v.Name='";

queryString += strNodeText;

queryString +=
"' ORDER BY p.Name";

BindBrowserNode(n, queryString, strNodeText);

n.Expanded =
true;

break;

case "Te": //chnology":

queryString =

"SELECT p.Name, 'Product.aspx?q=' + CONVERT(varchar(10), p.ProductID) AS TargetURL FROM Technology t INNER JOIN TechnologyProduct AS tp ON tp.TechnologyID = t.TechnologyID INNER JOIN Product AS p ON p.ProductId = tp.ProductId WHERE t.Name='";

queryString += strNodeText;

queryString +=
"' ORDER BY p.Name";

BindBrowserNode(n, queryString, strNodeText);

n.Expanded =
true;

break;

default:break;

}

}

private void BindBrowserNode(Node n, string queryString, string table)

{

SqlConnection conn = Data.GetConnection(Context);

SqlDataAdapter adapter = new SqlDataAdapter(queryString, conn);

DataSet ds = new DataSet();

adapter.Fill(ds, table);

tvBrowse.Levels[n.Level + 1].TargetUrlName =
"TargetURL";tvBrowse.NodeBound += new NodeBoundEventHandler(tvBrowse_NodeBound);

n.DataBind(ds.Tables[table].DefaultView, table);

}

 

Parents
No Data
Reply
  • 28464
    posted

    Hello,

    The ManualSmartCallbacks mode does have its limitations and databiding the treeview in the callback event handler or populating several levels of nodes at once (with child nodes) is I think not supported out of the  box.

    Is it possible for you to modify your scenario, so that you iterate through the DataTable of nodes and add to the expanded node on each expand request? 

Children
No Data