|
code
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Treeview Databindingpopulated from a database at runtime. In the page_load event i get the database and build it to xml, then I use it as a datasource for my treevieew. works great, except for one thing. I want to put a Special character into the begining of the value string for any node that has a child node. i have the code working but it dosn't acctually change the valueuntil the treeview is clicked on. after the first postback to the server everything works. but on the first display it dosn't contain the modifier. Here's the code: protected void TreeView1_DataBound(object sender, EventArgs e) { if (TreeView1.Nodes.Count > 0) { // Iterate through the root nodes in the Nodes property. for (int i = 0; i < TreeView1.Nodes.Count; i++) { if (TreeView1.Nodes[i].ChildNodes.Count > 0) { TreeView1.Nodes[i].Value = "$" + TreeView1.Nodes[i]. Value; TreeView1.Nodes[i].SelectAction = TreeNodeSelectAction. SelectExpand; DisableParentNodes(TreeView1.Nodes[i]); } } } } void DisableParentNodes(TreeNode node) { for (int i = 0; i < node.ChildNodes.Count; i++) { if (node.ChildNodes[i].ChildNodes.Count > 0) { node.ChildNodes[i].Value = "$" + node.ChildNodes[i].Value; node.ChildNodes[i].SelectAction = TreeNodeSelectAction. SelectExpand; DisableParentNodes(node.ChildNodes[i]); } } } See the Test Site at www.bettencourtfurniture.com/aspsite/itemstest.aspx
LoadControl by type
Upload Excel Spreadsheet GridView Edit Template Control Style Page Panels Drag 'n Drop support for custom asp.net catalogpart/catalogzone. How to prevent JavaScript conflict in custom server control (when added more than once to a page) Get argument with imageclickeventhandler. SqlDataSource is doing an Update after handeling an Insert excepti Datalist repeat colums ordering The tabstrip in Microsoft.Web.UI.WebControls won't display in Fire |
|||||||||||||||||||||||