asp.net - How do I access Page controls from within my custom server control? -


I am creating a modal box in the form of custom server control and I want to put a property on the target box TargetControlID That specifies the elements that will display the model when clicked. I have set the property in the modal box and in the code behind it, I use the following code block (which I have tried at several different places

  if (_targetControlId & lt ;> "") Then target WebControl = Me.Page.FindControl (_targetControlId) targetControl.Attributes.Add ("onclick", "test1 ();") targetControl.Attributes.Add ("onclick" , "Test2 ();") End if  

The goal is that the goal is always controlled, as long as it tries to add properties, Then the page causes the crash.I have checked the spelling of the target twice by ControlControlId

thanks,

Mike

First of all, let me tell you the behavior you are seeing already exists Free, open source, you just use it ommend If you still believe that you want to write your own, then at least I would recommend to see your code that it See Ase. ExtenderControlBase.FindControlHelper is a good place to start.


Comments

Popular posts from this blog

asp.net - Javascript/DOM Why is does my form not support submit()? -

sockets - Delphi: TTcpServer, connection reset when reading -

javascript - Classic ASP "ExecuteGlobal" statement acting differently on two servers -