Getting handle on contol programatically

  • Thread starter Thread starter Sosh123
  • Start date Start date
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
 
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).
 
Back
Top