Need to display the links in datalist of pros in redcolor who r working for us
-
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.