Getting handle on contol programatically

S

Sosh123

Hi,

I'm sure there's a really easy way of doing this, but I haven't found it
yet.

I have a bunch of asp:hyperlinks. I have their IDs stored in a
database. I want to be able to pull a record from the database and get
a handle on the control with that ID.

I thought FindControl might work something like this:

FindControl(IDvalueFromDatabase).CssClass = blah

But that doesn't work. How should I be using findControl? Or how about
another way of doing it?

Thanks
 
M

Matt Dockerty

That's how it works. I can only guess you aren't using FindControl on the
control that directly contains the hyperlinks (e.g. LinkPanel.FindControl).
FindControl only finds direct children of the current control (which would
be the page in that instance).
 

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,774
Messages
2,569,599
Members
45,175
Latest member
Vinay Kumar_ Nevatia
Top