How I can convet viewstate to bool array
private bool[] clientCollapse
{
get { return Convert.ToBoolean(ViewState["Collapse"]); }
set { ViewState["Collapse"] = value; }
}
Any ideas???
private bool[] clientCollapse
{
get { return (bool[])ViewState["Collapse"]; }
set { ViewState["Collapse"] = value; }
}
if will work if you set those values only using this propery, otherwise you can but there other type and cast will not work
BTW common naming convention for C# requires property names to start with capital: ClientCollapse
You can do this:
private bool[] clientCollapse
{
get { return (bool[])ViewState["Collapse"] ?? new bool[0]; }
set { ViewState["Collapse"] = value; }
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With