Binding RadioButtonList to nullable varchar workaround? (SelectedValue which is invalid because it does not exist…)

后端 未结 2 1827
小蘑菇
小蘑菇 2021-01-24 02:20

I have a nullable varchar column in a table in my database.
I am binding a gridview to this table via an objectdatasource and have a TemplateField like so:

          


        
2条回答
  •  醉话见心
    2021-01-24 03:00

    I'm not sure what DB you're using, but I'd start by using the NullIf statement for the nullable database fields.

    Select NullIf(RequirementOption, 'None') From ...
    

    That will help you avoid the Object Reference Not Set to an Instance of an Object errors because you won't be returning nulls from the data store.

提交回复
热议问题