yuvarajr
asked on
IE webcontrols treeview - how to make a node selected thro' code?
Hi Experts,
I'm using IE webcontrols treeview. I need to have a particular node in the tree hierarchy selected..Is that possible? I see a property called "expanded" which shows a specific node expanded but i dont see any property like "selected"..
Could someone pls help?.. Or is there any other treeview better than this?
Thanks in advance..
I'm using IE webcontrols treeview. I need to have a particular node in the tree hierarchy selected..Is that possible? I see a property called "expanded" which shows a specific node expanded but i dont see any property like "selected"..
Could someone pls help?.. Or is there any other treeview better than this?
Thanks in advance..
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks a lot guys..
Your very welcome my friend.
Aeros
Aeros
public class MeetingGicsDlg : MeetingDlgBase
{
protected Microsoft.Web.UI.WebContro
protected System.Web.UI.HtmlControls
protected System.Web.UI.WebControls.
private void Page_Load(object sender, System.EventArgs e)
{
if (!Page.IsPostBack)
{
this.Initialize();
BindGicNodes();
}
}
/// <summary>
/// Adds all nodes to a parent node in the Gic tree based on the
/// index of the node.
/// </summary>
protected void BindGicNodes()
{
MeetingGicData dsSectors = GICSystem.GetGicsSectors(t
if (dsSectors.Tables[0].Rows.
{
for (int i = 0; i < dsSectors.MEETING_GIC.Rows
{
TreeNode nodeSector = new TreeNode();
nodeSector.ID = dsSectors.MEETING_GIC[i].G
nodeSector.Text = dsSectors.MEETING_GIC[i].G
nodeSector.CheckBox = true;
nodeSector.Expandable = Microsoft.Web.UI.WebContro
nodeSector.Checked = dsSectors.MEETING_GIC[i].M
GicsTreeView.Nodes.Add(nod
MeetingGicData dsGroups = GICSystem.GetByGicParentID
if (dsGroups.Tables[0].Rows.C
{
for (int j = 0; j < dsGroups.Tables[0].Rows.Co
{
TreeNode nodeGroup = new TreeNode();
nodeGroup.ID = dsGroups.MEETING_GIC[j].GI
nodeGroup.Text = dsGroups.MEETING_GIC[j].GI
nodeGroup.CheckBox = true;
nodeGroup.Checked = dsGroups.MEETING_GIC[j].ME
if(nodeGroup.Checked)
{
nodeSector.Expanded = true;
}
nodeGroup.Expandable = Microsoft.Web.UI.WebContro
nodeSector.Nodes.Add(nodeG
MeetingGicData dsInd = GICSystem.GetByGicParentID
if (dsInd.Tables[0].Rows.Coun
{
for (int k = 0; k < dsInd.Tables[0].Rows.Count
{
TreeNode nodeInd = new TreeNode();
nodeInd.ID = dsInd.MEETING_GIC[k].GIC_I
nodeInd.Text = dsInd.MEETING_GIC[k].GIC_D
nodeInd.CheckBox = true;
nodeInd.Checked = dsInd.MEETING_GIC[k].MEETI
if(nodeInd.Checked)
{
nodeGroup.Expanded = true;
nodeSector.Expanded = true;
}
nodeInd.Expandable = Microsoft.Web.UI.WebContro
nodeGroup.Nodes.Add(nodeIn
MeetingGicData dsSubInd = GICSystem.GetByGicParentID
if (dsSubInd.Tables[0].Rows.C
{
for (int l = 0; l < dsSubInd.Tables[0].Rows.Co
{
TreeNode nodeSubInd = new TreeNode();
nodeSubInd.ID = dsSubInd.MEETING_GIC[l].GI
nodeSubInd.Text = dsSubInd.MEETING_GIC[l].GI
nodeSubInd.CheckBox = true;
nodeSubInd.Checked = dsSubInd.MEETING_GIC[l].ME
if(nodeSubInd.Checked)
{
nodeInd.Expanded = true;
nodeGroup.Expanded = true;
nodeSector.Expanded = true;
}
nodeSubInd.Expandable = Microsoft.Web.UI.WebContro
nodeInd.Nodes.Add(nodeSubI
}
}
}
}
}
}
}
}
}
#region Web Form Designer generated code
override protected void OnInit(EventArgs e)
{
//
// CODEGEN: This call is required by the ASP.NET Web Form Designer.
//
InitializeComponent();
base.OnInit(e);
}
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.Submit.Click += new System.EventHandler(this.S
this.Load += new System.EventHandler(this.P
}
#endregion
private int AddSelectedGics(TreeNodeCo
{
int nChecked = 0;
foreach (TreeNode tn in nodes)
{
int nChildChecked = 0;
if (tn.Nodes.Count > 0)
{
nChildChecked = AddSelectedGics(tn.Nodes);
}
if(tn.Checked)
{
if(nChildChecked == 0)
{
MeetingSystem.AddMeetingGi
}
nChildChecked++;
nChecked += nChildChecked;
}
}
return nChecked;
}
}
}