Tuesday, June 06, 2006 9:03 AM
by
secret.server
Dynamic Controls to make Web Password URL's clickable
Yesterday, I looked at the internals of the SecretView page for the first
time. It is dynamically adding controls to tailor the screen to each
specific SecretType. In ASP.NET, this can be a little tricky and involves
understanding the control lifecycle so that you get viewstate and postback to
behave correctly.
The feature I was working on is adding a hyperlink to a URL Secret Field -
this means that Web Passwords would now have clickable URL fields.
To get the feature working, I added a HyperLink webcontrol to each field as
it is bound by the repeater (Repeater_ItemCreated) and set visibility to false;
then in the Repeater_ItemDataBound event we check the fields for IsUrl when
binding and add the URL to the HyperLink control and set it visible. This
was one of the more complicated areas of the Secret Server codebase but having a
full suite of unit tests gave me some peace of mind while making the
changes.
--Shiva