The RadGrid control is capable of handling null values by default, so it is not needed to use a conditional data binding and explicit converting. You can use the following:
DbSelectedDate='<%# Eval("EXPIRY_DATE") %>'
Additionally, when using VB.NET it is recommended to use IF
instead of IIF
, since the IIF
function is executed for each part of the statement. You can find more information in the IF vs IIF
MSDN forum post. Moreover, Nothing
is used to specify that the variable's reference is not pointing to anything, while DBNull.Value is an object used to point out that the value coming from the DataBase is null.
If you want to keep using the conditional binding approach, the DBSelectedDate property should look like this:
DBSelectedDate='<%# If(IsDBNull(Eval("OrderDate")), DBNull.Value, Eval("OrderDate"))%>'
In general, we recommend that you take advantage of the built-in features of controls, so in this case you can skip the condition for the DBSelectedValue.
Get quickly onboarded and successful
with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.