Page.FindControl type casting

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
 
G

Guest

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!
***************************
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,007
Latest member
obedient dusk

Latest Threads

Top