|
|
对不起因为我在别的网站type 的很多,也不懂要如何用 话语解释,希望版主可以通融一下我参英文来发文和解释 :handshake:
for each xxx as web.ui.control in contentplaceholder.controls
Dim bbb as xxx.gettype() <--- got error
bbb = xxx
bbb.visible = false
...
...
next
p/s: because XXX can be textbox , label , chekcbox... any kind of webcontrol
i wish to dim a temporary object as same type as the xxx then assign the xxx to the temporary then only i can access it property like label control got text property , check box got chekced property....
current my alternative solution is
for each xxx as web.ui.control in contentplaceholder.controls
select case true
case if typeof(xxx) = label then
dim tempcontrol as lable
tempcontrol = ctype( xxx , label)
if tempcontrol.attribute("SGrounp") = "group1" then
tempcontrol.visible = "false"
End if
case if typeof(xxx) = textbox then
dim tempcontrol as textbox
tempcontrol = ctype( xxx , textbox)
if tempcontrol.attribute("SGrounp") = "group1" then
tempcontrol.visible = "false"
End if
case if typeof(xxx) = gridview then
dim tempcontrol as gridview
tempcontrol = ctype( xxx , gridview )
if tempcontrol.attribute("SGrounp") = "group1" then
tempcontrol.visible = "false"
End if
........
End select
next
in web page there are can be any kind of web control like panel , check box , table, dropdownlist ......
no way i can use so many select case to cater all kind of web control type
that is why i wish can do soemthing like
for each xxx as web.ui.control in contentplaceholder.controls
dim tempcontrol as typeof (xxx)
tempcontrol = ctype( xxx , typeof (xxx))
if tempcontrol.attribute("SGrounp") = "group1" then
tempcontrol.visible = "false"
End if
next
but i not able to dim a tempcontrol with dynamically when see what the xxx control is
dim an tempcontrol as typrof(XXX)
dim an tempcontrol as XXX.getype()
有什么方法么?
[ 本帖最后由 bee002 于 21-8-2009 11:39 AM 编辑 ] |
|