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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T00:04:43+00:00 2026-05-20T00:04:43+00:00

Sorry i’m new to .net and learning so this may be very simple. I

  • 0

Sorry i’m new to .net and learning so this may be very simple.

I have a page with a html table on and am accessing it from code behind and changing what is displayed depending on values from a database, I have managed to change what text is displayed and the background color but i’m struggling to change either a rows or a cells font/fore color.

I know my code probably isn’t the most efficient way of doing this but as i said i am learning.

Thanks in advance – J.

'Iterate through the rows of the table.
    For i = 0 To Table1.Rows.Count - 1

        'Iterate through the cells of a row.
        For j = 0 To Table1.Rows(i).Cells.Count - 1

            If i = 0 Then

                If (ds.Tables.Count > 0) And (ds.Tables(0).Rows.Count > 0) Then
                    Table1.Rows(i).BgColor = "#f4f4f4"
                Else
                    Table1.Rows(i).BgColor = "#ffffff"
                End If

                If j = 0 Then
                    If (ds.Tables.Count > 0) And (ds.Tables(0).Rows.Count > 0) Then
                        Table1.Rows(i).Cells(j).InnerHtml = "Personal"
                    End If
                End If

                If j = 1 Then
                    If (ds.Tables.Count > 0) And (ds.Tables(0).Rows.Count > 0) Then
                        Table1.Rows(i).Cells(j).InnerHtml = "Section complete"
                    Else
                        Table1.Rows(i).Cells(j).InnerHtml = "Please complete this section"
                    End If
                End If

                If j = 2 Then
                    If (ds.Tables.Count > 0) And (ds.Tables(0).Rows.Count > 0) Then
                        Table1.Rows(i).Cells(j).InnerHtml = "Tick"
                    Else
                        Table1.Rows(i).Cells(j).InnerHtml = "X"
                    End If
                End If

                If j = 3 Then
                    If (ds.Tables.Count > 0) And (ds.Tables(0).Rows.Count > 0) Then
                        Table1.Rows(i).Cells(j).InnerHtml = "<input id=""Button1"" type=""button"" value=""Edit"" />"
                    Else
                        Table1.Rows(i).Cells(j).InnerHtml = "<input id=""Button1"" type=""button"" value=""Add"" />"
                    End If
                End If

            End If
  • 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-20T00:04:44+00:00Added an answer on May 20, 2026 at 12:04 am

    You can use the CSSClass property of the Row element:

    Table1.Rows(i).CssClass = "YourClassName"
    

    or you can set the Style attribute:

    Table1.Rows(i).Attributes("style") = "color:red;"
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Sorry this is basic, but I'm new to Python and Django. I have a
Sorry, I'm sure this is simple but I'm tired and can't figure it out.
Sorry for a pretty specific question. I have a table (see bottom), and when
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
Sorry, guys.I am quite new in mysql but I do need help from getting
Sorry if this is a simple question, but I've only recently started learn coding
Sorry if this is a dumb question. I'm writing a simple 3 tier ASP
sorry but Im unable to understand these example. I started learning ajax right from
Sorry, this is along one to document.. OLD SETUP I have a J2ME client
Sorry for the basic question - I'm a .NET developer and don't have much

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.