Home > Net >  ASP.NET MVC : how to display int rating value in star in a table?
ASP.NET MVC : how to display int rating value in star in a table?

Time:05-16

I have a database like:

database

I want to display the rating of the question.

The column Rating is int contain the rating point from each user.

How can I display this int value as a rating star?

Please help me - how do I start my controller and view?

CodePudding user response:

You can achieve this using JQuery plugin , so you pass the value you want to the view as usual , the same way you pass all the model data , after that , The Jquery plugin is gonna take care of displaying that value in form of stars . all you have to do is including the Jquery plugin in your scripts and follow the documentation on how to use it. For that purpose , I advise you to use the RateYo plugin , you find here all the required info about it and how to use it . For mopre options , you may refer to this link to choose a different plugin

CodePudding user response:

  1. You need to add a new controller
  2. Add a new View
  3. Add a model to hold the value "Rating"
  4. look into how to get your connection string and connect to your database
  5. Initialise the model in your new controller
  6. populate the model with the value from the database
  7. return the model to the view

go step by step and research each bit

  • Related