Question : "cannot convert from 'object' to 'string'"

Development platform : c# asp.net 2.x, iis 6

I am getting a compiler error as follows:

"cannot convert from 'object' to 'string'"

for the line:  return bool.Parse(ViewState["_isChecked"];

your time and efforts with this enquiry are much apprieated.

many thanks.

Answer : "cannot convert from 'object' to 'string'"

from VS2005 help:

C#  Copy Code
private const int defaultFontSize = 3;

// Add property values to view state with set;
// retrieve them from view state with get.
public String Text
{
    get
    {
        object o = ViewState["text"];
        return (o == null)? String.Empty : (string)o;
    }

    set
    {
        ViewState["Text"] = value;
    }
}

 
Random Solutions  
 
programming4us programming4us