Monday, March 14, 2005

Fwd: [itsdifferent] Need Help

---------- Forwarded message ----------
From: Ripesh Shah
Date: Mon, 14 Mar 2005 12:42:10 +0530
Subject: [itsdifferent] Need Help
To: itsdifferent@yahoogroups.com

Hi All

I have created Five User Controls
Say

UserControl1.ascx
UserControl2.ascx
UserControl3.ascx
UserControl4.ascx
UserControl5.ascx

all user Controls have diffrent Objects Like
UserControl1 have 5 TextBoxes and
UserControl2 have 5 radio buttons etc ...

Now say in Page1.aspx I am Dynamically Loading User Control Based on
Sessions Value and adding in Pages Panel Control

Control objControl;
objControl = LoadControl(hshControl[Session["UserControlId"]]);
pnl.Controls.Add(objControl);

where hshControl is hashtable

hshControl = new Hashtable();
hshControl.Add("1","UserControlPath/UserControl1.ascx");
hshControl.Add("2","UserControlPath/UserControl2.ascx");
hshControl.Add("3","UserControlPath/UserControl3.ascx");
hshControl.Add("4","UserControlPath/UserControl4.ascx");
hshControl.Add("5","UserControlPath/UserControl5.ascx");

Now I am Type Casting that Control to my Created User Control
that i can do like

UserControl1 objUserControl1;
objUserControl1 = (objUserControl1)objControl;

but this TypeCasting and Creation of an Object of User Control i need
to make it Dynamic instead of say using Switch case or If Else
based on sessions value
How can i do that ??

Any Ideas?

Note: This Group is not a Job Searching Group, so please co-operate
and dont transfer any kind of job related material across this
Group.AnyOne doing so can be banned from the Group
Thanx , Group Co-Ordinators

Yahoo! Groups Sponsor
ADVERTISEMENT

________________________________
Yahoo! Groups Links

To visit your group on the web, go to:
http://groups.yahoo.com/group/itsdifferent/

To unsubscribe from this group, send an email to:
itsdifferent-unsubscribe@yahoogroups.com

Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.

--
--
Regards...
/*******************************
itsDifferent
http://its-Different.blogspot.com
http://groups.yahoo.com/group/itsdifferent/join
http://groups.msn.com/its-Different/join
http://groups-beta.google.com/group/itsdifferent
*******************************/

1 comment:

job opportunitya said...

Enchanting blog. Your site was off the chain and I
will return! I peep the web for blogs just like this
one.
Want to see top notch work, peep my plastic surgery san diego blog site for the bomb work!