在页面加载时,我正在执行以下代码行:
nm.notify(YOUR_NOTIF_ID, n1);
nm.notify(YOUR_NOTIF_ID_2, n2);
有了这个我在每一行都在改变ImageUrl,无论是否是“unos”,但我只想用AKCIJA =“unos”来改变行。
看起来像GridView:
For Each row As GridViewRow In gvRD.Rows
If dt.Rows(0).Item("AKCIJA").ToString = "unos" Then
Dim myListBox As ImageButton = DirectCast(row.FindControl("btn"), ImageButton)
myListBox.ImageUrl = "~/Images/no_edit.png"
myListBox.Enabled = False
End If
Next
答案 0 :(得分:2)
如果在GridView的DataKeyNames中包含字段“AKCIJA”:
<asp:GridView ID="gvRD" runat="server" DataKeyNames="AKCIJA" ... >
您可以检索每行的字段值:
For Each row As GridViewRow In gvRD.Rows
If gvRD.DataKeys(row.RowIndex).Values("AKCIJA").ToString() = "unos" Then
...
End If
Next
答案 1 :(得分:0)
这是你的意思吗?
For Each row As GridViewRow In gvRD.Rows
Dim myListBox As ImageButton = DirectCast(row.FindControl("btn"), ImageButton)
If myListBox.ImageUrl = "unos" Then
myListBox.ImageUrl = "~/Images/no_edit.png"
myListBox.Enabled = False
End If
Next