|
Subject:
|
Convert "String" type to "Control" type ?
|
|
Posted By:
|
kishore_peddi
|
Post Date:
|
10/14/2003 11:27:23 AM
|
Hi,
I have a string "Panel". Now i want to convert this string "Panel" to the control type "Panel"( What we have already control). Please let me know how it is possible in C#.
Advance ThanX for your time & patience.
Cheers, Kishore
|
|
Reply By:
|
myselfdeepu
|
Reply Date:
|
11/20/2005 11:28:46 PM
|
hi all, i want answe for the same question plz let me answer soon
thanks Deepak
|
|
Reply By:
|
Ankur_Verma
|
Reply Date:
|
11/21/2005 3:22:10 AM
|
What is it that you are trying to ask? Do you mean that you want to CREATE a control of the type name stored in one of your string variables. Like if you have the value of your string varibale as "Panel" you want to create a panel type control (please varify if this IS what you are trying to do). For doing such a thing there must be some way through reflection. Explore that. But simpler way would be to write a logic (something like a switch case ...) which checks the string variable's value and creates a control of the relevent type.
Regards Ankur Verma
|
|
Reply By:
|
rahulpokharna
|
Reply Date:
|
1/9/2006 9:37:59 PM
|
hi all, even i wanted to ask the same question. the problem is there is already a control named panel1.. now there is a string literal which contains "panel1". Now i wanted to convert this string into that control. Please reply
regards rahul pokharna
|
|
Reply By:
|
planoie
|
Reply Date:
|
1/11/2006 12:21:12 PM
|
You can look in the controls collection of the page (or any class derived from "Control") and find a control by name:
myPanel = (Panel)Page.FindControl("panel1")
-Peter
|