TK, are you using vs.net or are you coding this in a tool like web matrix or
just plain note pad. Thing is, if your using web matrix or note pad, the
approaches these tools use is spaghetti code that is a combination of the
presentation with code. Vs.net makes it easier to seperate your code from
your presentation by using a concept which you might have already heard of
"Codebehind" classes. The reason i'm telling you this is because some of the
sample code on msdn/gotdotnet/docs assume you are not using vs.net for your
development and provide you with sample as to how to achieve your goals
using the spaghetti code approach. This is why on the example code you are
seeing it reads "'For each valid ucid there is a strong type associated with
the user control using className in the ascx page." and if you are coding
using code behind classes then you do not have to bother with this --clarify
this for me and what it is you want to do i'll provide you with the help you
need ;P
[quoted text, click to view] "TK" <tklawsuc@hotmail.com> wrote in message
news:9c5a156d.0402241111.4c17ef46@posting.google.com...
> I have x number of user controls that have a strong type (e.g.
> className uc1). I am able to access their properties through a single
> aspx page using:
>
> uc = LoadControl(path to control based on querystring value)
> textbox.Text = CType(uc, uc1).someproperty
>
> The thing I need to do though is to specify the type (e.g. uc1) on the
> fly based on the path created for that user control. For example
> (ignoring declarations):
>
> path = "path to user control directory"
>
> 'For each valid ucid there is a strong type associated with the
> 'user control using className in the ascx page.
> ucid = request.querystring("ucid")
>
> uc = LoadControl(path & ucid)
>
> 'Add the user control to the page
> placeholder.Controls.Add(uc)
>
> This is where I am stuck...
> I need to access the properties of the control based on the ucid.
> When I hard code it I use CType and specify the user control
> className.
> But in this case I do not know which user control will be called as it
> depends on the ucid (all the user controls have the same properties).
> There may 20-30 user controls and I would hate to have to hard code
> each of the possibilities.
>
> Ultimately I am looking for something like this:
>
> path = "path to user control directory"
> ucid = request.querystring("ucid")
> uc = LoadControl(path & ucid)
> placeholder.Controls.Add(uc)
> textbox.text = uc.someproperty
>
>
> Thx for any help or direction!
>
> Tom