DBNull, checkbox update issue in formview control asp.net 2.0
Posted on 2006-11-27
I had an issue using a checkbox where my sql server database uses the bit data type but allows NULL values. it would give me an error message. I worked around the issue with the following formula and functions...
getChkStat calls the functions below in the code behind...
Public Shared Function IsNullStr(ByVal s As String) As Boolean
If s = "1" OrElse s.ToUpper = "TRUE" Then
Public Function getChkStat(ByVal s As String) As Boolean
If IsNullStr(s) Then
If s = "True" Then
If I use Bind("ApplicantHas3YrsExperience") instead I get an error due to the null value. The problem with
getChkStat( Eval("ApplicantHas3YrsExperience").ToString()) is that I cannot get the formview to update after I check the checkbox. I put a a check in, hit Update and then there is no check - not good! Every other textbox that I change does get updated just not my checkbox. There must be a better way to do this. Thanks!