ASP.Net清除htmltable中的所有TextBox [英] ASP.Net Clear all TextBoxes in htmltable
本文介绍了ASP.Net清除htmltable中的所有TextBox的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我在Table标签中有多个按钮。我该如何比较按钮的文字。我有以下功能,但它返回Tablerowcollection并且没有进一步检查该行内的控制。
我应该怎么做?
以下是我的代码 -
对于 每个 ctl 作为控制在 selectSort中。控制
Dim 按钮 As System.Web.UI.WebControls.Button = TryCast (ctl,System.Web.UI.WebControls.Button)
如果按钮 IsNot Nothing 然后
如果 button.Text = btn_Filter1.Text 然后
button.Visible = True
btn_Filter1.Visible = False
结束 如果
结束 如果
下一步
selectSort是表ID
解决方案
< blockquote>试试这个:
对于 每个 tblRw 作为控制在 selectSort.Controls
对于 每个 tblCell As Control 在 tblRw.Controls
对于 每个 ctl 作为控制在 tb lCell.Controls
Dim 按钮 As System.Web.UI.WebControls.Button = TryCast (ctl,System.Web.UI.WebControls.Button)
如果按钮 IsNot 没什么 然后
If button.Text = btn_Filter1.Text 然后
button.Visible = 真
btn_Filter1.Visible = 错误
结束 如果
结束 如果
下一步
下一步
下一步
Hi,
I have multiple Buttons in Table tag. how should i compare text of buttons. I have following function but it returns Tablerowcollection and does not further to check control inside that row.
how should i do it?
following is my code-
For Each ctl As Control In selectSort.Controls
Dim button As System.Web.UI.WebControls.Button = TryCast(ctl, System.Web.UI.WebControls.Button)
If button IsNot Nothing Then
If button.Text = btn_Filter1.Text Then
button.Visible = True
btn_Filter1.Visible = False
End If
End If
Next
selectSort is Table ID
解决方案
Try This :
For Each tblRw As Control In selectSort.Controls For Each tblCell As Control In tblRw.Controls For Each ctl As Control In tblCell.Controls Dim button As System.Web.UI.WebControls.Button = TryCast(ctl, System.Web.UI.WebControls.Button) If button IsNot Nothing Then If button.Text = btn_Filter1.Text Then button.Visible = True btn_Filter1.Visible = False End If End If Next Next Next
这篇关于ASP.Net清除htmltable中的所有TextBox的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文