Reputation: 1491
The following exception:
Exception: An error occurred while executing the command definition.
See the inner exception for
and there is no inner exception.
Is thrown from the following code from the getter:
bool IsVerifyingPassword
{
get
{
return (bool?)ViewState["IsDoubleCheckPassword"] ?? false;
}
set { ViewState["IsDoubleCheckPassword"] = value; }
}
Where's my fault?
Upvotes: 0
Views: 285
Reputation: 62484
Try out:
bool IsVerifyingPassword
{
get
{
bool returnValue = false;
object viewStateValue = ViewState["IsDoubleCheckPassword"];
if (viewStateValue != null)
{
// stay false if not able to retrieve bool from ViewState
bool.TryParse(viewStateValue.ToString(), out returnValue);
}
return returnValue;
}
If the property really should be nullable boolean then:
bool? IsVerifyingPassword
{
get
{
object viewStateValue = ViewState["IsDoubleCheckPassword"];
if (viewStateValue != null)
{
bool returnValue = false;
// stay false if not able to retrieve bool from ViewState
bool.TryParse(viewStateValue.ToString(), out returnValue);
return returnValue;
}else
{
return null;
}
}
Upvotes: 2