locked
Error - Object cannot be cast from DBNull to other types RRS feed

  • Question

  • User-1499457942 posted

    Hi

      On below code i get above error . Actually i am saving Y/N in database . I want if Y it should be shown as Yes else No.

    <%# Convert.ToBoolean(Eval("Male")) ? "Yes" : "No" %>

    Thanks

    Sunday, August 26, 2018 9:20 AM

Answers

  • User-1499457942 posted

    Resolved

    <%# Convert.ToString(Eval("Male")) == "Y" ? "Yes" : "No" %>

    Thanks

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Sunday, August 26, 2018 9:22 AM