[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

microsoft.public.dotnet.framework.aspnet.mobile

Accessing user control in code-behind for page

Edward J. Stembler

10/24/2002 2:43:00 PM

Anyone know how to access a user control in the code-
behind for the page (*.aspx.vb)? The user control is
properly being used in the *.aspx, but I cannot access it
on the *.aspx.vb code. I found some examples which access
user controls in the *.aspx via in-line script code,
however, I was hoping I could access it in the code-behind
source *.aspx.vb.
3 Answers

Alex Crookes

10/24/2002 3:09:00 PM

0

You can do it and how depends on if it's compiled to a
class library or not. If it's compiled, you can add it as
a reference to the project and declare it as a
usercontrol.

If not, you have to use reflection, which is a little
more of a pain in the ass but works.

Don't have a code example right now, but a quick search
should give some examples.
>-----Original Message-----
>Anyone know how to access a user control in the code-
>behind for the page (*.aspx.vb)? The user control is
>properly being used in the *.aspx, but I cannot access
it
>on the *.aspx.vb code. I found some examples which
access
>user controls in the *.aspx via in-line script code,
>however, I was hoping I could access it in the code-
behind
>source *.aspx.vb.
>.
>

Edward J. Stembler

10/24/2002 3:21:00 PM

0

Ah, okay; I had a feeling I might be able to do it if I
compiled it into a dll. Thanks!


>-----Original Message-----
>You can do it and how depends on if it's compiled to a
>class library or not. If it's compiled, you can add it as
>a reference to the project and declare it as a
>usercontrol.
>
>If not, you have to use reflection, which is a little
>more of a pain in the ass but works.
>
>Don't have a code example right now, but a quick search
>should give some examples.
>>-----Original Message-----
>>Anyone know how to access a user control in the code-
>>behind for the page (*.aspx.vb)? The user control is
>>properly being used in the *.aspx, but I cannot access
>it
>>on the *.aspx.vb code. I found some examples which
>access
>>user controls in the *.aspx via in-line script code,
>>however, I was hoping I could access it in the code-
>behind
>>source *.aspx.vb.
>>.
>>
>.
>

Edward J. Stembler

10/24/2002 9:44:00 PM

0

Nevermind. Using reflection via Page.FindControl works
great.

While I could compile my VB *.ascx MobileUserControl into
a class library, I could not install it in the Toolbox. I
was trying to achive the same effect of Microsoft's
Toolbox installable MobileDynamicImage, which lives in a
class library (DLL) and was written in C#.


>-----Original Message-----
>Ah, okay; I had a feeling I might be able to do it if I
>compiled it into a dll. Thanks!
>
>
>>-----Original Message-----
>>You can do it and how depends on if it's compiled to a
>>class library or not. If it's compiled, you can add it
as
>>a reference to the project and declare it as a
>>usercontrol.
>>
>>If not, you have to use reflection, which is a little
>>more of a pain in the ass but works.
>>
>>Don't have a code example right now, but a quick search
>>should give some examples.
>>>-----Original Message-----
>>>Anyone know how to access a user control in the code-
>>>behind for the page (*.aspx.vb)? The user control is
>>>properly being used in the *.aspx, but I cannot access
>>it
>>>on the *.aspx.vb code. I found some examples which
>>access
>>>user controls in the *.aspx via in-line script code,
>>>however, I was hoping I could access it in the code-
>>behind
>>>source *.aspx.vb.
>>>.
>>>
>>.
>>
>.
>