0
我試圖隱藏「刪除」鏈接,如果在CUST_ORDER_ID =「X」的價值,但我不知道如何設置visibility屬性爲「False」從代碼更改visibility屬性後面
我ASP。
<Columns>
<asp:CommandField ShowDeleteButton="True" />
<asp:BoundField DataField="ROWID" SortExpression="ROWID" Visible="False"> </asp:BoundField>
<asp:BoundField DataField="CUST_ORDER_ID" HeaderText="ORDER ID" SortExpression="CUST_ORDER_ID">
<ItemStyle Width="50px"></ItemStyle>
背後
Protected Sub GridView1_RowDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles GridView1.RowDataBound
If e.Row.RowType = DataControlRowType.DataRow Then
'check is row non order type and allow user to delete
Dim oid As TableCell = e.Row.Cells(2)
If oid.Text = "X" Then
Dim tb As Button = e.Row.Cells(1).Controls(1)
'Dim tb = e.Row.FindControl("DeleteButton")
tb.Visible = "False"
End If
End If
End Sub
的代碼,你可能要添加一個* ASP/asp.net *標記,即可* ASP *問題吸引* ASP *注意 – Plutonix
@Plutonix只是做了他。 – Codexer
爲什麼不能在HTML上添加Visible屬性? – techspider