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 6925533
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T10:48:05+00:00 2026-05-27T10:48:05+00:00

I am creating a WEB report in Visual Studio 2010 in VB.net. The report

  • 0

I am creating a WEB report in Visual Studio 2010 in VB.net. The report needs to display a table (please see the attached image). I am thinking to use the GridView component which i think it’s the most appropriate one to choose. In the database there are students’ data and marks. I can’t alter the database in any way and i have to use Visual Studio 2010 with VB.

What i need to do is to show 3 different pictures(for example) depend on the student’s marks. I got the pictures file in PNGs but this can be flexible.For example, over 70 will be a Smile picture. over 60 will be the Normal face. and over 40 will be the picture with no smile. I bit difficult for me to explain but i hope u get my point.

So pls advice me how can i achieve this. I am quite a newbie to this pls put as detail as you can. if there is a choice between client and server side script, i prefer server side script. Data source can be flexible (sql, or linq or anything).

enter image description here

  • 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-27T10:48:06+00:00Added an answer on May 27, 2026 at 10:48 am

    You should use RowDataBound to bind data to controls in your GridView.

    Following is a complete sample with aspx and codebehind(says more than thousand words):

    <style type="text/css">
        .GridViewRowStyle
        {
            background-color: #A0CFEC;
            color:Blue;
        }
        .GridViewAlternatingRowStyle
        {
            background-color:White;
            color:#15317E;
        }
        .GridViewHeaderStyle
        {
            background-color:White;
            color:#15317E;
        }
    </style>
    
    <asp:GridView ID="GridStudents" AutoGenerateColumns="false" GridLines="None" runat="server">
        <RowStyle  CssClass="GridViewRowStyle" />
        <AlternatingRowStyle CssClass="GridViewAlternatingRowStyle" />
        <HeaderStyle CssClass="GridViewHeaderStyle" />
        <Columns>
            <asp:TemplateField HeaderText="Student">
               <ItemTemplate>
                    <asp:label runat="server" ID="LblStudent" Text='<%# Bind("Student") %>'></asp:label>
                </ItemTemplate>
            </asp:TemplateField>
             <asp:TemplateField HeaderText="Mark">
               <ItemTemplate>
                    <asp:label runat="server" ID="LblMark" Text='<%# Bind("Mark") %>'></asp:label>
                </ItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField HeaderText="">
               <ItemTemplate>
                    <asp:Image runat="server" ID="ImgSmiley" />
                </ItemTemplate>
            </asp:TemplateField>
        </Columns>
    </asp:GridView>
    

    Codebehind(with sample-data):

    Private Sub GridStudents_RowDataBound(sender As Object, e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles GridStudents.RowDataBound
        Select Case e.Row.RowType
            Case DataControlRowType.DataRow
                Dim row = DirectCast(e.Row.DataItem, DataRowView)
                Dim ImgSmiley = DirectCast(e.Row.FindControl("ImgSmiley"), Image)
                Select Case DirectCast(row("Mark"), Int32)
                    Case Is < 50
                        ImgSmiley.ImageUrl = "~/Images/Smiley_Grim.png"
                        ImgSmiley.ToolTip = "bad"
                    Case Is < 70
                        ImgSmiley.ImageUrl = "~/Images/Smiley_Def.png"
                        ImgSmiley.ToolTip = "ok"
                    Case Else
                        ImgSmiley.ImageUrl = "~/Images/Smiley_Laugh.png"
                        ImgSmiley.ToolTip = "fine"
                End Select
        End Select
    End Sub
    
    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        If Not IsPostBack Then
            BindData()
        End If
    End Sub
    
    Private Sub BindData()
        Dim tblStudent As New DataTable("Students")
        Dim colStudent = New DataColumn("Student", GetType(String))
        Dim colMark As New DataColumn("Mark", GetType(Int32))
        tblStudent.Columns.Add(colStudent)
        tblStudent.Columns.Add(colMark)
    
        Dim newRow = tblStudent.NewRow
        newRow("Student") = "Tom"
        newRow("Mark") = 70
        tblStudent.Rows.Add(newRow)
        newRow = tblStudent.NewRow
        newRow("Student") = "Bob"
        newRow("Mark") = 40
        tblStudent.Rows.Add(newRow)
        newRow = tblStudent.NewRow
        newRow("Student") = "Danny"
        newRow("Mark") = 60
        tblStudent.Rows.Add(newRow)
        newRow = tblStudent.NewRow
        newRow("Student") = "Sussie"
        newRow("Mark") = 40
        tblStudent.Rows.Add(newRow)
    
        GridStudents.DataSource = tblStudent
        GridStudents.DataBind()
    End Sub
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am creating a report on an asp.net web page using an html table
I am using the asp.net web application and microsoft visual studio reportviewer control and
I am creating web page using asp.net. Is it possible to remove/hide the browsers
I want to display font dialog box in my web application(asp.net). Im using the
I'm creating web site on local computer. i'm using SQL Server 2005 management studio.
In Asp.Net for creating a huge pdf report iam using ThreadPool.QueueUserWorkItem, My requirement is
I am creating a web application using C#.net. I'm using a hierarchical grid to
When creating web parts for Sharepoint, is it better to create an actual web
When creating web pages how do we achieve a consistent font size across browsers.
Is there a way when creating web services to specify the types to use?

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.