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