Avatar of footballencounters
footballencounters

asked on 

Changing Table Cell Background Color and Attributes

Can someone please explain how I can change the background color of a cell to a different color depending on the value of a querystring.

Ideally this would be done through a SELECT CASE statement but I cannot get the following to work. Or if there is a better way please explain.

Thanks in advance

Dim menuViewState As String        
        menuViewState = Request.QueryString("viewstate")
        
        Select menuViewState
            Case 1
                'Something Here
            Case 2
                'Something Here
            Case Else
                Dim tblMenuTable As Table
                tblMenuTable.Rows(0).Cells(0).Attributes.Add("bgcolor", "#d8e9f9")
        End Select

Open in new window

ASP.NET.NET ProgrammingVisual Basic.NET

Avatar of undefined
Last Comment
Geoff Sutton
Avatar of burakiewicz
burakiewicz
Flag of United States of America image

tblMenuTable.Rows(0).Cells(0).BackColor = System.Drawing.ColorTranslator.FromHtml("#d8e9f9");
ASKER CERTIFIED SOLUTION
Avatar of Geoff Sutton
Geoff Sutton
Flag of Canada image

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
.NET Programming
.NET Programming

The .NET Framework is not specific to any one programming language; rather, it includes a library of functions that allows developers to rapidly build applications. Several supported languages include C#, VB.NET, C++ or ASP.NET.

137K
Questions
--
Followers
--
Top Experts
Get a personalized solution from industry experts
Ask the experts
Read over 600 more reviews

TRUSTED BY

IBM logoIntel logoMicrosoft logoUbisoft logoSAP logo
Qualcomm logoCitrix Systems logoWorkday logoErnst & Young logo
High performer badgeUsers love us badge
LinkedIn logoFacebook logoX logoInstagram logoTikTok logoYouTube logo