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:
01330703
Views:
16
>>
>>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.

I only need to attach Client event if my FormName is a particular name (or I just add a property AttachGenderChange or something). I can not have multiple forms active at the same time and each form has only one GeneralInfo control.
If it's not broken, fix it until it is.


My Blog
Previous
Reply
Map
View

Click here to load this message in the networking platform