I've created a Dictionary like
Dictionary<department,bool> dict= new Dictionary<department,bool>();
here Department is a class and I have `DepartmentId,Name and Code` for the departments. And in the `bool` am sending whether the person is `HOD` or not.
Am adding the records to this Dictionary like
here the records are successfully added to the Dictionary and after this am binding the Dictionary to a GridView like
now the inserted records are displayed fine in the gridview. After this am storing this records in the 'StaffDepartments' table in my database. I have 3 columns in the 'Staffdepartments' table
1.StaffId(PK - has link with the Staff table)
2.DepartmentId(PK - has link with the Department table)
here the records are stored fine in the database.No problem in adding the records into the database.
I have some questions here
****1.How can check whether the DepartmentId is already there in the Dictionary before adding to it.
2.When am editing the staff detail how can I delete the Selected Department from the Dictionary by checking the checkbox in Gridview rows.(here the records are coming from the database, so when I click delete button the records should be deleted in the database as well)****
if its a List instead of Dictionary, I can get the DepartmentId by
int departmentId = (int)gridDept.DataKeys[row.RowIndex].Values["DepartmentId"];
but in Dictionary i dunno how to do the same with Key and Value pairs....can anyone help me here.