0

text.contains( "9999999")ステートメントでtrueを返すことができません。インデックスが1の列にはID番号があります。これらのIDはアンカータグが付けられており、ID番号が9999999の場合は、タグを削除する必要があります。メインのifステートメントの他のすべてが正しく機能します。

If e.Row.RowType = DataControlRowType.DataRow Then
        lDate = e.Row.Cells(8).Text
        e.Row.Cells(7).Text = ConvertDate(e.Row.Cells(7).Text, True)
        e.Row.Cells(8).Text = ConvertDate(e.Row.Cells(8).Text, True)

        If e.Row.Cells(1).Text.Contains("9999999") = True Then
            Regex.Replace(e.Row.Cells(1).Text, "</?(a|A).*?>", "")
            Dim yoasd As String = e.Row.Cells(1).Text
        End If

        If e.Row.Cells(8).Text.Trim = "" Or lDate < lToday Then
            e.Row.BackColor = Drawing.Color.BurlyWood
        End If
    End If

私も試しました:

If e.Row.Cells(1).Text = "9999999"
If e.Row.Cells(1).Text.Trim = "9999999"
If e.Row.Cells(1).Text.Contains("9999999") Then
4

1 に答える 1

0

RowDataBoundでこれを試すことができます

If e.Row.RowType = DataControlRowType.DataRow Then
dim toberemoved as string = DataBinder.Eval(e.Row.DataItem, "ColumName")
if toberemoved = "9999999" then
Regex.Replace(e.Row.Cells(1).Text, "</?(a|A).*?>", "")
//Morestuff here
End If
End If

ColumNameをcolumの実際の名前に置き換えることを忘れないでください

*メモリから構築されたテストは行われていません。

于 2013-01-02T22:06:13.277 に答える