troubleshooting Question

assign db value to dropdownlist when its null

Avatar of Fraser_Admin
Fraser_AdminFlag for Canada asked on
.NET ProgrammingASP.NET
8 Comments6 Solutions355 ViewsLast Modified:
how do you handle null integer values from an objectdatasource.

i'm trying to assign the value of a dropdownlist, when its null, i'm happy to just pass by the statement, but nothing i'm trying works.

ie.
If Not dr.Userid Is DBNull.Value Then ddlUser.Text = dr.Userid

but i keep getting an error that null cannot be casted.  what is the proper way to do this?
Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 6 Answers and 8 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 6 Answers and 8 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros