Page.FindControl type casting

  • Thread starter Thread starter Martin Eyles
  • Start date Start date
M

Martin Eyles

Hi,

I am using Page.FindControl in a loop to select some numbered tags

aTag = Page.FindControl("Tick_" + CStr(aNumber))

however, when I come to add a style to this

aTag.Style.Add("visibility", "visible")

I can't, because aTag is too general a type of object. I need to cast it
back the the type that it actually is (an HTML control, rather than a plain
control).

How would I do this?

Thanks,
ME
 
Cast it:

Dim MyObject as HTMLControl = Ctype(aType, HTMLControl)
MyObject.Style.Add("visibility", "visible")


--
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA

***************************
Think Outside the Box!
***************************
 
Back
Top