nUnitASP: HowTo reference ASP.NET UI controls within custom User Control?

nUnitASP: HowTo reference ASP.NET UI controls within custom User Control?

Post by dutchma » Wed, 26 May 2004 17:38:55


Hi all,

I want to write a bunch of tests using nUnitASP for a custom ASP.NET
User Control I had created.

Custom User Control contains <asp:datagrid> UI control and few
<asp:dropdownlist> controls.

Usually I would do the following in ASP.NET code to get the
reference of UI control stored within custom User Control:

-------
UserControl ucDataGrid =
(UserControl)this.FindControl("dgTicketListID");
DropDownList cboFilterItem =
(DropDownList)ucDataGrid.FindControl("cboFilterItems");

cboFilterItem.SelectedIndex= 1;
------

But UserControlTester object (used for User Conrol testing,
AFAIK)from 'nUnitASP' package does not have FindControl method....

Is there anything I can do to reference UI controls within User
Control?
 
 
 

1. ASP.NET Templated User Controls - Limit child controls allowable within a templated control

2. Issues in ASP.NET 2.0 when dynamically loading user controls or asp.net web controls???

Hello,

I'm new to ASP.NET and I've been looking into the topic of dynamically
loading (typically accomplished with a LoadControl followed by a
MyControl.Controls.Add()) both user controls and asp.net web controls. I
searched for articles on the internet and in the end I must say that I'm
confused.
I read about issues related to:

a.. events not firing
b.. state management
c.. postbacks
but a lot of these articles were old, dealing with v1.1 or even v1.0 of the
framework so I really don't know if any of these issues still exist and what
they are. I know however that Microsoft used this technique of dynamic
controls loading in the old IBuySpy portal starter kit ..... so I maybe it
is not so bad.

Could anyone please briefly recap if any issues still exist in ASP.NET v2.0
when dynamically loading user controls (.ascx) and/or asp.net web
controls???
Thanks.


Bob Rock

3. reference web control in dynamically added user control, ASP.NET 2

4. Custom Control VS User Control (NOT ASP.NET)

5. Difference between ASP.NET web controls and ASP.NET mobile control

6. Custom validation on a control in a user control.(asp.net 2.0)

7. Add control to asp:PlaceHolder on asp.net page from user control on same page

8. Add Controls within Treeview Control asp.net v2.0

9. Add control to asp:PlaceHolder on asp.net page from user control on same page

10. Custom control within User control within XML template

11. ControlDesigner not invoked on custom control when control is rendered within another custom control

12. Panel Controls inside a custom server control in ASP.NET

13. Custom Templated Control not rendering asp.net controls correctly

14. Problems with user controls after a asp.net 1.1 -> asp.net 2.0