Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

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.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6345407
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T20:48:57+00:00 2026-05-24T20:48:57+00:00

I am building a basic blog module that allows the user to rate the

  • 0

I am building a basic blog module that allows the user to rate the blog posts.

The ratings are submitted via an ajax extension and held in a data table as an INT value.

When I call the ratings onto the page using a variable I would like to calculate the overall average rating.

Could anyone shed some light on how I would go about doing this?

Here is my code:

var rating = from x in db.DT_Control_BlogRatings
                         where x.Blog_ID == int.Parse(codesnippets.Decrypt(Request["blg"].ToString(), true))
                         select new
                         {
                             x.RatingNo,
                             x.RatingID,
                         };

            string usercount = rating.Count().ToString();

            LB_UserRating.Text = "Currently rated " + usercount + " times";

Many thanks!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T20:48:58+00:00Added an answer on May 24, 2026 at 8:48 pm
    // Extract the blog id before the query, because this instruction can't be translated to SQL
    int blogId = int.Parse(codesnippets.Decrypt(Request["blg"].ToString(), true));
    
    var ratings = from x in db.DT_Control_BlogRatings
                  where x.Blog_ID == blogId
                  select x.RatingNo;
    var avg = ratings.Average();
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am building a Django application that is a pretty basic blog, so far
I am building a basic Image editor. In my app, if the user wants
I'm building a basic CRUD library, that I anticipate use in both local (add
I am building a basic POS app for my cousin's pharmacy store so that
I'm building a basic search function for my site. Realising that the most useful
I'm building a website that requires very basic markup capabilities. I can't use any
Rails Newb here asking his first question.... I'm building a personal blog-style website that
I'm building a basic photo uploading system which works like: User registers by providing
I'm building a basic CodeIgniter site that requires a login before you can access
I am building a basic RSS reader app that, which the 'story' is clicked,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.