This is a migrated thread and some comments may be shown as answers.

Tree Binding

2 Answers 64 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
Venkat
Top achievements
Rank 1
Venkat asked on 02 Sep 2010, 11:50 AM
Dear Friends,
 I am using SQL Table with Fields,
  • MENU_ID (Primary key with autoincrement values)
  • PARENT_ITEM (int) (for storing parent id's)
  • CHILD_ITEM (string) (for storing text values)

I have binded the value to tree view control as

       "List<clsMenu> listmenu = objadmin.GetMenuValues();
        trRolePrivilages.DataTextField = "CHILD_ITEM";
        trRolePrivilages.DataFieldID = "MENU_ID";
        trRolePrivilages.DataFieldParentID = "PARENT_ITEM";
        trRolePrivilages.DataSource = listmenu;
        trRolePrivilages.DataBind();"

Now, when i am creating a role for particular user (example: marketing user), I need to select only particular items in treeview using checkboxes, after checking the particular items, it should get saved in my ROLE TABLE for that particular  user, these are all the items listed.

so i need to populate those with menus

so when admin login, he has all the menu items and when marketing user login, he has only limited number of items. What can i do?
How to do this? cud anyone help me? Its very Urgent

2 Answers, 1 is accepted

Sort by
0
Cori
Top achievements
Rank 2
answered on 02 Sep 2010, 02:39 PM
Hello Venkat,

You should check the user that is logged into your application by looking at Page.User.Identity.Name, which will give you the username of the logged in user. From there you can filter the list based on the logged in user.

I hope that helps.
0
Venkat
Top achievements
Rank 1
answered on 03 Sep 2010, 05:56 AM
Thanks for your reply "Cori".
But my doubt is
  • How can i get the id of only checked parent and child items
  • How can i store that id in SQL

The table structure to store is show in attachement. I need to store the checked values and id in this structure

How can i?  Please help...
Tags
TreeView
Asked by
Venkat
Top achievements
Rank 1
Answers by
Cori
Top achievements
Rank 2
Venkat
Top achievements
Rank 1
Share this question
or