I am using a Jquery plugin for selection.
Here is the link.
Now what I have done is instead of Select in Html, I have putted a ListBox,set its selectiomode 'Multiple '
and binded it with db.(As suggested by one of the Expert)
<asp:ListBox ID="lstRole" class="multiselect" multiple="multiple" SelectionMode="Multiple" runat="server"></asp:ListB
private void FillRole()
AccessRights accessRights = new AccessRights();
Dictionary<object, object> dictRole = accessRights.GetAllRole();
lstRole.DataSource = dictRole;
lstRole.DataTextField = "Value";
lstRole.DataValueField = "Key";
On Save Button,
I am getting the selected values.
protected void imgbtnSave_Command(object sender, CommandEventArgs e)
List<string> selectedItems = new List<string>();
foreach (ListItem item in lstRole.Items)
string allSelectedItems = String.Join(",", selectedItems.ToArray());
I have stored these values in a seperate table.And now I want to fetch them and show in the listbox as already selected.
Please let me know if I miss any explanation.
Your help is very much appreciated.