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 ThendrRow =
CType(CType(e.Item.DataItem, DataRowView).Row, DataRow)proCurrenctCityID =
CType(drRow("CityID"), Int32) If ViewState("PrevCityID") <> proCurrenctCityID ThenViewState(
"PrevCityID") = proCurrenctCityIDViewState(
"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 = 0objAnchor =
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 ThenstrFormatCompanyName = Mid(drRow(
"CName").ToString, 1, PNAME_LENGTH)objAnchor.InnerText = strFormatCompanyName +
"..." ElseobjAnchor.InnerText = drRow(
"CName").ToString End If ''End Workaround for hard links 'End IfViewState(
"Count") += 1 End If End SubProtected
Sub dtlst_ItemCommand(ByVal source As Object, ByVal e As System.Web.UI.WebControls.DataListCommandEventArgs) Dim strdirection As String = "" If e.CommandArgument.ToString() <> "" Thenstrredirection =
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 SubThanks in advance
Replies
Know the answer? Post it — somebody with the same question will find it here.