Hi
Code
C#
ltrlAvgRating.Text = Result.AvgRating.ToString();
plchStar.Controls.Add(new System.Web.UI.WebControls.Literal { Text = Utility.StarRating(5, Convert.ToDecimal(Result.AvgRating)) });Thanks
Hi
ltrlAvgRating.Text = Result.AvgRating.ToString();
plchStar.Controls.Add(new System.Web.UI.WebControls.Literal { Text = Utility.StarRating(5, Convert.ToDecimal(Result.AvgRating)) });Thanks
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
Prasad RaveendranRank #320 · 7.8K reputationPosted Jun 12, 2023, 10:38 PM EDT
When I tried to execute the method, I have got the below string
I'm just wondering whether you have the proper CSS classes.
Prasad RaveendranRank #320 · 7.8K reputationPosted Jun 11, 2023, 9:50 PM EDT
Make sure to review the code within the Utility.StarRating method and verify that it's generating the desired output correctly. Additionally, ensure that the plchStar control is correctly placed within the page's layout and that it's visible and properly rendered.
If you need further assistance, please provide more information about the Utility.StarRating method or any other relevant code snippets.
Ramco RamcoRank #462 · 5.4K reputationPosted Jun 12, 2023, 5:02 AM EDT
Hi
public static String StarRating(Decimal Star, Decimal Rating) { try { Boolean RoundFigRating = false; String StarString = ""; for (int i = 1; i = i) { StarString += ""; } else { if (RoundFigRating == false) { StarString += ""; RoundFigRating = true; } else { StarString += ""; } } } return StarString; } catch (Exception ex) { return ""; } }Thanks
Deepak RawatRank #646 · 3.7K reputationPosted Jun 19, 2023, 7:00 AM EDT
Ensure the
StarRatingmethod is implemented correctly and returns the expected output. Verify that it generates the HTML for the star rating based on the given rating value.Confirm that the
ltrlAvgRatingcontrol is correctly bound to theResult.AvgRatingvalue. Make sure thatResult.AvgRatinghas a valid value and is not null.Check if the
plchStarplaceholder control is correctly placed within the HTML markup and is present on the rendered page. Verify that it's not hidden or conditionally excluded from the page's display.Verify that there are no JavaScript errors or conflicts on the page that might prevent the star rating from being rendered properly.
Consider checking the generated HTML source code of the rendered page to see if the star rating HTML markup is present. You can use browser developer tools to inspect the rendered HTML and check if the generated star rating HTML is present and has the expected structure.