Removing Top attribute for webform controls
-
Hi, How can I remove the 'Top' attribute of all controls in the form dynamically i.e. I want to do this before render. First I want to check weather the type of control is web control or not, because in my form I have some user controls also. I tried it with using form.controls, but it is giving invalid cast exception. How can I do this? Regards, Chakravarthy.V
-
Hi, How can I remove the 'Top' attribute of all controls in the form dynamically i.e. I want to do this before render. First I want to check weather the type of control is web control or not, because in my form I have some user controls also. I tried it with using form.controls, but it is giving invalid cast exception. How can I do this? Regards, Chakravarthy.V
If you look at the 'Get All TextBoxes On A Page' thread you should be able to utilise and amend the code in my post there to iterate controls on a page and identify WebControls. Once you've got an instance of a web control you should be able to use the WebControl.Attributes.Remove method to remove attributes from a server control's AttributeCollection object I believe, (not that I've tried it myself). Hope this helps :-) Rhys A bus station is where a bus stops. A train station is where a train stops. On my desk I have a workstation... Vampireware /n/, a project, capable of sucking the lifeblood out of anyone unfortunate enough to be assigned to it, which never actually sees the light of day, but nonetheless refuses to die.