SqlCommand cmdPickAllAccessebility = DBManager.DataAccess.command();
cmdPickAllAccessebility.Parameters.Add(new SqlParameter("@option", SqlDbType.VarChar, 50));
cmdPickAllAccessebility.Parameters["@option"].Value = "PickAllAccessebility";
cmdPickAllAccessebility.Parameters.Add(new SqlParameter("@User_identity", SqlDbType.VarChar, 50));
cmdPickAllAccessebility.Parameters["@User_identity"].Value = rbtnForSelectUser.SelectedValue.ToString();
string sqlquery2 = "SchoolProc";
DataSet dsetPickAllAccessebility = DBManager.DataAccess.getdata(sqlquery2);
for (int i = 0; i < CheckBoxListForSelectingPrivileges.Items.Count; i++)
{
for (int j = 0; j < dsetPickAllAccessebility.Tables[0].Rows.Count; j++)
{
if (dsetPickAllAccessebility.Tables[0].Rows[j].ToString() == CheckBoxListForSelectingPrivileges.Items[i].Value)
{
CheckBoxListForSelectingPrivileges.Items[i].Selected = true;
}
else
{
CheckBoxListForSelectingPrivileges.Items[i].Selected = false;
}
}
}
this was my code for retrieving the data from database and checked the check box list
but i am not getting any output
i will clearly explain about my problem
i am having a page called administration page.in that page we can see all the user in radio button list(binded all the users to radio button list) and all the privileges in check box list (binded all the privileges to check box list list)
by selecting particular user and selecting particular privileges to that user by checking the check box list that will save in table "User_Access" like below
registration table
user_id | login_id | password
1 |nitish | ******
privileges table
access_id | Description | status
1 | admission | true
2 | events | true
3 |fee-collection| true
User_Access table
user_id |access_id
1 | 2
1 | 3
like the above table i am saving....
what was my problem if next time i selected the same user i want to see the privileges what all ready he is having by retrieving the data from User_Access table
here i am using access_id as data value field for check box list.
in data set i am getting the access_id called as the data value fields of check box list
now what i want is according to the user_access table when we select user_id 1 in admin page it should show the check box list with check box 2,3 should be checked and 1 should be unchecked