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

May 28 2008 2:26 AM

Hai 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

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

Protected Sub dtlst_ItemCommand(ByVal source As Object, ByVal e As System.Web.UI.WebControls.DataListCommandEventArgs)

Dim strdirection As String = ""

If e.CommandArgument.ToString() <> "" Then

strredirection = String.Format("~/xyz/Details.aspx?ID= {0}&CName={1}&CName={2}&ID={3}&Page={4}", e.CommandArgument.ToString(), e.CommandName.ToString(), Request.QueryString("CityName"), Request.QueryString("ID"), "City")

Response.Redirect(strdirection)

End If

End Sub

Thanks in advance