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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T06:44:00+00:00 2026-06-14T06:44:00+00:00

Using VWD 2010 Express, ASP.NET, VB.NET. I have a gridview that is bound to

  • 0

Using VWD 2010 Express, ASP.NET, VB.NET.

I have a gridview that is bound to a database table, it contains 10 columns, one of which is hidden.

I would like to set a background colour of the rows which have a due date (the last column, index 8 in gridview) of anything before the current day.

So far I have this: (defined under the RowCreated event)

Dim i As Integer = 8
If e.Row.RowType = DataControlRowType.DataRow Then
    If e.Row.Cells(i).Text <= Date.Now.ToString Then
        e.Row.Cells(i).ForeColor = System.Drawing.Color.Red
    End If
End If

However, problem, I receive an error:

“Specified argument was out of the range of valid values, parameter:
index”

All the objects in the gridview are boundfields.
The only index which doesn’t return this error is index 0, any advice?

When using index 0, it only colours the very first cell in each of the rows, and I don’t think that’s dependant on the date at all, as it seems to colour them all red.

  • 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-06-14T06:44:01+00:00Added an answer on June 14, 2026 at 6:44 am

    Managed to find a fix, instead of using the index of the column, I used the column name, like so:

        If e.Row.DataItem("DueDate") < Date.Now.ToString Then
            e.Row.BackColor = Drawing.Color.Red
        End If
    

    NOTE: I declared this in RowDataBound, not in RowCreated.

    Works perfectly, left this here for anyone else with a similar problem. Indexing doesn’t seem very accurate in this instance.

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

Sidebar

Related Questions

I'm using Visual Web Developer 2010 Express on my laptop to run some ASP.Net
Running VWD 2010 Express on a windows 7 machine. I have a asp:listview (on
I have an ASP.Net application that is using Windows Authentication and I have specified
I'm having problems deploying my website to the live server using VWD 2010 Express.
So far I was using VWD 2010 express quite smoothly on Windows XP. Now
Good evening/morning/after/noon. I have an ASP.net 3.5 website and I am using vb.net in
Using ASP.NET MVC there are situations (such as form submission) that may require a
Working in VWD 2010 Express I have an aspx.vb file with the following connection
Windows 7, visual web developer express 2010, c#, asp.net, webforms. Running program with ctrl-F5
Converting vb web project to c# using vwd express 2010. Development system is a

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.