void filltrv()
{
try
{
trvCategory.Nodes.Clear();
var n = (from y in ss.GetInstance.GetAllMenus()
where y.Parent_Menu_ID == 0
select y).ToList();
for (i = 0; i < n.Count; i++)
{
TreeNode tn = new TreeNode();
tn.Tag = n[i].Menu_ID.ToString();
tn.Text = n[i].Menu_Name.ToString();
trvCategory.Nodes.Add(tn);
}
for (i = 0; i < trvCategory.Nodes.Count; i++)
{
var nn = (from y in ss.GetInstance.GetAllMenus()
where y.Parent_Menu_ID == Convert.ToInt32(trvCategory.Nodes[i].Tag.ToString())
select y).ToList();
if (nn.Count > 0)
{
for (int j = 0; j < nn.Count; j++)
{
TreeNode tn1 = new TreeNode();
tn1.Tag = nn[j].Menu_ID.ToString();
tn1.Text = nn[j].Menu_Name.ToString();
trvCategory.Nodes[i].Nodes.Add(tn1);
}
}
}
}
catch (Exception ex)
{
}
}
private void trvCategory_AfterSelect(object sender, TreeViewEventArgs e)
{
try
{
int x=trvCategory.SelectedNode.Level;
if (x == 0)
{
TxtParentMenu.Text = trvCategory.SelectedNode.Text;
ParentMenuID = Convert.ToInt32(trvCategory.SelectedNode.Tag);
}
else
{
TxtParentMenu.Text = trvCategory.SelectedNode.Parent.Text;
ParentMenuID = Convert.ToInt32(trvCategory.SelectedNode.Parent.Tag);
}
trvCategory.Visible = false;
CmbSequence.Enabled = true;
BindSequence();
}
catch (Exception ex)
{
}
}
DataBase Design
No comments:
Post a Comment