Access control(s) inside ITemplate from code-behind
-
I try to build a custom control. In the control, it has a collection of X custom control, while there is a ITemplate in X in which contains other controls. For example, The problem is I cann't access the "a" and "b" control directly from the code behind. I have to call FindControl () which it makes my code looks stupid (while you have a ten control to call). And i think it has a more ellegent way so i can call the control directly from the code behind. Please help me !!!!
-
I try to build a custom control. In the control, it has a collection of X custom control, while there is a ITemplate in X in which contains other controls. For example, The problem is I cann't access the "a" and "b" control directly from the code behind. I have to call FindControl () which it makes my code looks stupid (while you have a ten control to call). And i think it has a more ellegent way so i can call the control directly from the code behind. Please help me !!!!
-
IMO, you still need to use the FindControl method to get reference to the TexBoxes declared in the template, and you can expose them as a public property in the X custom control so that you can directly use them in code-behind.
Then why when i using a Atlas UpdatePanel inside my custom control, i can access the nested control directly. For example With the help of atlas, this time i can access "a" from code-behind. So i think it should have a way to populate nested controls in design mode. -- modified at 7:31 Thursday 21st September, 2006
-
Then why when i using a Atlas UpdatePanel inside my custom control, i can access the nested control directly. For example With the help of atlas, this time i can access "a" from code-behind. So i think it should have a way to populate nested controls in design mode. -- modified at 7:31 Thursday 21st September, 2006