I have a user control like this
<uc1:wucSwitchButton3States runat="server" State="true" ID="wucSwitchButton3States" />
in the user control code behind I have declared a nullable property named state
public bool? State { get; set; }
if I set State as true of false it works fine but if I set it as null like this
<uc1:wucSwitchButton3States runat="server" State="null" ID="wucSwitchButton3States" />
I encounter with following error:
Cannot create an object of type 'System.Nullable`... from its string representation 'null' for the 'State' property.
I even tried State="" and State="<%=null%>" but none of them solved the issue, do you have any idea to resolve the problem?
based on the CheckBox Code, id did not try it myself but: