Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Programming UserControls
Message
General information
Forum:
ASP.NET
Category:
Other
Environment versions
Environment:
C# 3.0
OS:
Windows XP
Network:
Windows 2003 Server
Database:
MS SQL Server
Miscellaneous
Thread ID:
01330659
Message ID:
01330697
Views:
19
This message has been marked as a message which has helped to the initial question of the thread.
>
>Interesting. Does it mean I can do something like
>
>FormView frmRegular = (FormView) this.Page.FindControl("myFormViewName")
>if ...
Can you? Yes, it should work. However I wouldn't do an explicit cast and I wouldn't hardcode in the control name. If the control doesn't exist your code will throw an exception. Instead, something like:
FormView regular = Page.FindControl(this.FormViewNameProperty) as FormView;

if (regular != null)
(you'd need to create a property in your user control, I'm using FormViewNameProperty as an example).

You may also need to think about what happens when you've got multiple instances of the same user control on the form.
-Paul

RCS Solutions, Inc.
Blog
Twitter
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform