G
Guest
Hi
I have a listbox with multiple values. I want to store those selected values in an arraylist. I am not sure how to write the arraylist with ViewState in C#. The following code is the string datatype, not arraylist.
My questions ar
1. How to modify string SelectedDeptIDs to be an arraylist with ',' to be delimiter to store all selected listitems
2. How can I retrieve those values in arraylist (splite with ',' to be delimiter) when postback? Do I use Items.Clear() and Items.Add()
[code
protected string SelectedDeptID
ge
return ViewState["SelectedDeptIDs"] == null? ""string)ViewState["SelectedDeptIDs"]
se
ViewState["SelectedDeptIDs"] = value
foreach (System.Web.UI.WebControls.ListItem li in listDept.Items
if (li.Selected
SelectedDeptIDs = li.Value
[/code
Thanks for help.
I have a listbox with multiple values. I want to store those selected values in an arraylist. I am not sure how to write the arraylist with ViewState in C#. The following code is the string datatype, not arraylist.
My questions ar
1. How to modify string SelectedDeptIDs to be an arraylist with ',' to be delimiter to store all selected listitems
2. How can I retrieve those values in arraylist (splite with ',' to be delimiter) when postback? Do I use Items.Clear() and Items.Add()
[code
protected string SelectedDeptID
ge
return ViewState["SelectedDeptIDs"] == null? ""string)ViewState["SelectedDeptIDs"]
se
ViewState["SelectedDeptIDs"] = value
foreach (System.Web.UI.WebControls.ListItem li in listDept.Items
if (li.Selected
SelectedDeptIDs = li.Value
[/code
Thanks for help.