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

  • SEARCH
  • Home
  • 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 7004169
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T21:09:52+00:00 2026-05-27T21:09:52+00:00

In my aspx page I have a gridview which displays the value from my

  • 0

In my aspx page I have a gridview which displays the value from my database as “*“. So if a value in my database table is 5, it will be displayed as “*****” in the gridview.

code in aspx:

<asp:TemplateField HeaderText="Rating" SortExpression="Rating">
              <ItemTemplate><h1><%# getrating(Eval("Rating"))%></h1></ItemTemplate>
            </asp:TemplateField>

code in aspx.vb

Protected Function getrating(ByVal rate As Integer)
        Dim retval As String
        retval = ""
        For i = 1 To rate
            retval = retval + "*"
        Next
        Return retval
    End Function

What I want to do is change that “*” to a picture, ie star.jpg, so in the gridview it will display the image star.jpg instead of “*“.

Any idea on how to do this please? Using MS visual studio 2010

  • 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-27T21:09:52+00:00Added an answer on May 27, 2026 at 9:09 pm

    You should be able to just do something like the following:

    retval = retval + "<img src=""star.jpg"" alt=""*"">"
    

    You may need some styling to put them all on the same line (float:left should do) but I forget offhand whether that is necessary.

    The principle of this is obviously pretty basic. In the outputted HTML you will just have an image tag where before you had a *. A neater way to do it might be to have five images for one to five and then have something like:

    Protected Function getrating(ByVal rate As Integer)
        Dim retval As String
        retval = String.Format("<img src=""Star{0}.jpg"" alt=""{0} stars"">", rate)
        Return retval
    End Function
    

    This will output an image tag pointing to any of Star1 to Star5. This is nicer in some ways because it allows better control over how they look as well as allowing you to make five identical sized images and know that the space used will always be the same.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

In my .aspx page, I have an <asp:GridView runat=server ID=CustomerGridView> control which I bind
Basically in my in my aspx page I have a gridview which displays the
I have a GridView on my aspx page which displays a collection of objects
I have a GridView on a .aspx page with a hidden column which has
So I have a GridView in my ASPX page. When I click <asp:Button id=btnBindIt
In my .aspx page which derives from a master page I have a contact
I have a GridView which retrieves data from a database. Users have roles, some
i am having a asp.net and c#.net application and i have a page gridview.aspx
I have an ASP.NET 4.0 home page which displays about 20 product listings. Each
I have an aspx page which has a GridView and a Panel with Summary

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.