Click here to Skip to main content
15,894,291 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hi All
i have used a rating control in my project.and bind that rating control in with datalist.i had bind the datalist using a storeprocedure and linq technique i have used a table named as rating table and a view which holds the avg rating,ratedto,usertype .and i am displaying the rating as

XML
<ajaxToolkit:Rating runat="server" ID="Rating1" MaxRating="5"
                            CssClass="ratingStar" StarCssClass="ratingItem" WaitingStarCssClass="Saved"   CurrentRating= '<%#Eval("rating") %>'
                       OnChanged ="rating_Changed" FilledStarCssClass="Filled" EmptyStarCssClass="Empty" AutoPostBack="True"
                               ReadOnly ="true"  ></ajaxToolkit:Rating>




here in the datalist i am displaying all the usertype both rated and unrated.it shows me error that rating control can convert null value to int32 type.SO how will i display the avg rating.i want to display the rating through the 5 star rating and if those are not rated showed me with empty star.
how will i handle this null value and convert to int or zero for which are not rated.
if anybody knows the solution then please solve this.


Thanks in Advance To all.
Posted

1 solution

Your first issue is to work out why you have a null value. Then you can use ?? to convert null to the default you want.
 
Share this answer
 
Comments
CPallini 25-Jan-11 7:39am    
Cannot understand why such a legitimate answer was downvoted.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900