I am using the following line of code to format the data in my RadGrid column:
columns.Bound(p => p.Price).Format("${0:0.00}");
It works fine when the item has a price but throws a NullReferenceException when the price field is null.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
If you have your model defined to accept null for the Price field, there is nothing in the RadGrid that should throw a NullReferenceException. Just to make sure I build a dummy grid that has a bound column that matches the code in your question. In my model, I set the value of the price field to null for one of the items. The result was just an empty cell for that item.