Administrator

Administrator

  • Tech Writer
  • 2.2k
  • 1.5m

Controls and WebControls

Mar 11 2003 12:19 PM
I can loop through the controls on a page and capture the HtmlForm control, then loop through the controls on the HtmlForm, and capture if a Control was of the types TextBox or Button, (which I'm interested in). What I want to do is use the Attribute.Add() method to add some client side functions to these controls, but a 'Control' doesn't doesn't recognise these although a WebControl does. Strangely though, no error is generated in Visual Studio.net on compilation, it's generated when th page is loaded in a browser, giving me a standard error page. So now I'm looking at a way of assigning the HtmlForm's child Control 'TextBoxes' and 'Buttons' as WebControl TextBoxes and Buttons so I can utiltise the Attributes.Add(string KEY, string VALUE) method. How do I get get a handle on these Controls as WebControls, or is there another way to iterate thru' all Controls on a page to do what I want???

Answers (2)