如果 Hyperlink.Text = 0 如何使 Hyperlink.Visible=False
如果超链接中没有任何文本值,我试图隐藏中继器中的超链接可见性。像这样的事情:
Protected Sub rptReferenca_ItemDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.RepeaterItemEventArgs) Handles rptReferenca.ItemDataBound
Dim lnkThumb As HyperLink = CType(rptReferenca.FindControl("lnkThumb"), HyperLink)
If lnkThumb.Text = 0 Then
lnkThumb.Visible = False
End If
End Sub
但这当然行不通。任何帮助表示赞赏。
I am trying to hide Hyperlink visibility in Repeater if there isn't any Text value in Hyperlink. Something like this:
Protected Sub rptReferenca_ItemDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.RepeaterItemEventArgs) Handles rptReferenca.ItemDataBound
Dim lnkThumb As HyperLink = CType(rptReferenca.FindControl("lnkThumb"), HyperLink)
If lnkThumb.Text = 0 Then
lnkThumb.Visible = False
End If
End Sub
But of course it doesn't work. Any help is appreciated.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
尝试将其更改为:
...至此:
Try changing this:
...to this:
您即将完成:
需要从 RepeaterItemEventArgs 中提取控件并检查文本的长度。
You're almost there:
Need to extract the control from the RepeaterItemEventArgs and check the Length of the text.
不确定 VB 如何处理这个问题,但您正在根据 int 检查字符串。
或许
Not sure how VB handles this but you are checking a string against an int.
Maybe