Last post Oct 28, 2010 07:12 AM by dhonuevo
Oct 18, 2010 03:11 AM|dhonuevo|LINK
I created an Extender which has a custom property that drills down a list XML elements from an xml file, where users can select xml elements during design-time. This works perfectly fine. However, my code only has a hardcoded xml filename (source of the
xml elements list) and I need to change this by maxing the xml file user-specified.
What I did is that I created another control (panel) which has a custom property that when clicked (through the ellipsis), it will allow a developer to select the xml file which is supposed to be the source xml file that the Extenders shall use. The filedialog
from custom panel's property works perfectly fine.
However, my problem now is that when I drag-drop my Extender, I cannot find a way to get the property value of the custom Panel Control which contains the xml filename. I tried creating a static variable which I thought the custom controls can share but
VS2010 is breaking.
Please take note that my problem is on Design-time, asp.net.
Appreciate any help. Thanks a lot.
Oct 20, 2010 02:39 AM|Qin Dian Tang - MSFT|LINK
Why you create two custom control. I think you can add the function of the second control into the first one. You can make the file can be selected in the first control directly. Or you can create a property of the filename in the first control. Then, on
the page which you use the custom control you can use a TextBox or file upload control to input the filename. Then set this name to the property of this custom control like you set a Text property to Label control from the TextBox user entry.
Oct 20, 2010 10:57 AM|dhonuevo|LINK
Hi Qin Dian Tang,
Thanks for your reply.
I need two controls for below purpose:
1. The first control is a custom panel which will expose a property where the filename of the source xmlfile shall be indicated.
2. The 2nd is an extender control which is linked to several web controls (textboxes, labels, checkboxes, etc.). This extender control shall add a property which when clicked displays a dropdown that lists down all the contents elements from the source xmlfile.
I cannot combine the 2 controls into 1 because of below reasons:
1. We don't want users to input xmlsource file for every extender created. Such actions could be by the hundreds of controls on one template/webform.
2. Our templates/webforms should be linked to different xmlfile sources which are created by different users. Our templates are by the hundreds as well (or more than a thousand).
From your answer, are you also saying that one user control cannot read a property value from another control?
Thanks in advance for your reply.
Oct 20, 2010 10:27 PM|Qin Dian Tang - MSFT|LINK
For the user control it can be done easily like this. I haven't tried the custom control.
Oct 28, 2010 07:12 AM|dhonuevo|LINK
The link you have provided is accessing controls on runtime... My need is from design-time.