changing backgroung color name in css file while selecting dropdown

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • suganya
    New Member
    • Dec 2006
    • 39

    #1

    changing backgroung color name in css file while selecting dropdown

    hi

    I have a dropdown with values as blue & green. If I select "blue" from the dropdown then, all the backcolor which I have specified as green in seperate css class file should change into blue. So that I can see all the buttons view which is in green color as blue immediately in the current page. what coding should I give in the selected index changed event of dropdown....
  • SWATHITHIRUNAGARI
    New Member
    • Sep 2008
    • 7

    #2
    added
    Code:
     tags
    
    [code=vbnet]Imports System
    Imports System.Data
    'Imports System.Web.UI.WebControls.TableCell
    Imports System.Data.SqlClient
    Partial Class _Default
        Inherits System.Web.UI.Page
        Dim logintime As String
        Protected Sub GridView1_RowDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles GridView1.RowDataBound
            Dim log As Decimal = 0
            If (e.Row.RowType = DataControlRowType.DataRow) Then
                If e.Row.Cells(5).Text <> String.Empty Or e.Row.Cells(5).Text <> "&nbsp;" Then
                    logintime = Format(Convert.ToDateTime(e.Row.Cells(5).Text), "hh.mm")
                    log = Convert.ToDecimal(logintime)
                End If
                If Math.Round(log) > 9.3 Then
                    e.Row.BackColor = Drawing.Color.Red
                Else
                    e.Row.ForeColor = Drawing.Color.White
                    e.Row.BackColor = Drawing.Color.Blue
    
                End If
            End If
        End Sub
    End Class

    Comment

    • Frinavale
      Recognized Expert Expert
      • Oct 2006
      • 9749

      #3
      Most ASP.NET Controls have a property called CSSClass.
      Since you have CSS classes "blue" and "green" all you have to do is set the controls' CSSClass property to be "blue" or "green"

      Eg:
      [code=vbnet]
      myAspNetControl .CssClass = "blue"
      [/code]

      -Frinny

      Comment

      • Curtis Rutland
        Recognized Expert Specialist
        • Apr 2008
        • 3264

        #4
        See your other thread.

        Comment

        Working...