Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Database & SysAdmin
  3. Database
  4. Need to display the links in datalist of pros in redcolor who r working for us

Need to display the links in datalist of pros in redcolor who r working for us

Scheduled Pinned Locked Moved Database
databasedesignhelptutorialquestion
1 Posts 1 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    subbu sk
    wrote on last edited by
    #1

    Hi all, i had one datalist which appear all the pros for all the cities in the links of blue color. but i need to display the link color in red to those pro who r working for us. i add one column in database 'workus' a bit. if 'workus' is true then it will display in red color.else in blue color. Protected Sub dtlstPros_ItemDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.DataListItemEventArgs) Dim objAnchor As HtmlAnchor Dim drRow As DataRow Dim proCurrenctCityID As Int32 = 0 Dim proPrevCityID As Int32 = 0 Dim intRecCount As Int16 = 0 If e.Item.ItemType = ListItemType.AlternatingItem Or e.Item.ItemType = ListItemType.Item Then drRow = CType(CType(e.Item.DataItem, DataRowView).Row, DataRow) proCurrenctCityID = CType(drRow("CityID"), Int32) If ViewState("PrevCityID") <> proCurrenctCityID Then ViewState("PrevCityID") = proCurrenctCityID ViewState("Count") = 0 End If 'If ViewState("RecCount") < DISP_NOOF_PROS Then ''Workaround for hard links Dim strRedirection As String = "" Dim strFormatCompanyName As String = "" Dim intLen As Int16 = 0 ***********workus = Convert.ToBoolean(drRow("workus ")) If zoompro = True Then objAnchor = CType(e.Item.FindControl("ancPro"), HtmlAnchor) objAnchor.Style.Add("cssClass", "text12red") 'objAnchor.Style.Add("style", "*") Else objAnchor = CType(e.Item.FindControl("ancPro"), HtmlAnchor) End If*************** objAnchor = CType(e.Item.FindControl("ancPro"), HtmlAnchor) strRedirection = String.Format("~/xyz/Details.aspx?ID= {0}&CName={1}&CName={2}&ID={3}&Page={4}", drRow(Cas.GUID).ToString, drRow(cas.CNAME).ToString, Request.QueryString("Name"), Request.QueryString("ID"), "City") objAnchor.HRef = strRedirection intLen = drRow("CName").ToString.Length If intLen > PNAME_LENGTH Then strFormatCompanyName = Mid(drRow("CName").ToString, 1, PNAME_LENGTH) objAnchor.InnerText = strFormatCompanyName + "..." Else objAnchor.InnerText = drRow("CName").ToString End If ''End Workaround for hard links 'End If ViewState("Count") += 1 End If End Sub can any one help me how to change the color of 'anctag' to red if workus=true Thanks in advance

    Thanks Subbu.

    1 Reply Last reply
    0
    Reply
    • Reply as topic
    Log in to reply
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes


    • Login

    • Don't have an account? Register

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • World
    • Users
    • Groups