Custom Control HELP

How do I access parameter data from a control:

<MC:MYCONTROL Runat="server" Id="MyControl1">
  <MYPARAMETER>My Input 1</MYPARAMETER>
 <MYPARAMETER>My Input 2</MYPARAMETER>
</MC:MYCONTROL>

Thanks
kandenAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Bob LearnedCommented:
Not enough information here.  What is MyParameter?  A collection?

Bob
0
kandenAuthor Commented:
I'm not sure.

I need  to set propertires from the control when I'm not sure how many there are. It might be a template or somthing like that.

Here is an example I have seen. How is this set-up in the .VB file.


<MYCONTROL:Parent  Runat="server">

<MYCONTROL:Child formfieldname="FNAME" dbfieldname="user_fname"></MYCONTROL:Child>
<MYCONTROL:Child formfieldname="LANME" dbfieldname="user_lname"></MYCONTROL:Child>
<MYCONTROL:Child formfieldname="ADDRESS" dbfieldname="user_address</MYCONTROL:Child>

</MYCONTROL:Parent>
0
Bob LearnedCommented:
What do you mean, "I'm not sure".  Are you inheriting a project that you didn't create?

What is MYCONTROL defined as?

Bob
0
Cloud Class® Course: Microsoft Azure 2017

Azure has a changed a lot since it was originally introduce by adding new services and features. Do you know everything you need to about Azure? This course will teach you about the Azure App Service, monitoring and application insights, DevOps, and Team Services.

kandenAuthor Commented:
"Are you inheriting a project that you didn't create?"

Yes, I am trying to recreate a control.

I am very new to custom controls, I have seen this done before were a child control is nested in a parent control. I am trying to exe a sqlcommand with indefinite number of parameters. Maybe you could just explain what ToolboxData is used for?

<ToolboxData("<{0}:DateTimeControl runat=server></{0}:DateTimeControl>"), ParseChildren(True)>

Thanks Sorry for the confusion
0
Bob LearnedCommented:
In the control project, is there a class called 'Parent', and one called 'Child'?

Bob
0
kandenAuthor Commented:
No,

this is hypothetical.

The ultimate goal is to understand what is going on.
0
Bob LearnedCommented:
>>The ultimate goal is to understand what is going on.
So, you want me to explain something about which I have no understanding of either.  I can only make educated guesses at what you are even talking about.

Bob
0
kandenAuthor Commented:
Sorry Bob,

Maybe I need to wait until I understand a little more.

The main thing is understanding what ToolboxData is and does.

Gary
0
Bob LearnedCommented:
Gary,

Here is a good explanation of the metadata attributes that are useful when creating a custom web control:

Creating Web Custom Controls With ASP.Net 1.1 - Part III - Using Metadata Attributes
http://highertendencies.com/articles/237.aspx

<Quote>
ToolboxData Attribute
The ToolboxData attribute is assigned to a class and is where you define how the IDE will write the aspx xml data for the control when it is added from the toolbox. Where assemblies and their Namespaces are registered with an aspx page, one of the property values of the registration tag is the TagPrefix value that is associated with the assembly. The TagPrefix default value is cc1. This value should be picked up as a variable along with the rest of the toolbox data you specify in this attribute.

My ToolboxData attribute values normally follow this format:

    ToolboxData("<{0}:ImageButton runat=server></{0}:ImageButton>")

The {0} part of the value is where the TagPrefix value from the page registration is used. To not include this would be very dangerous. For the other part of the tag name, I have never had a reason to use a different value other than the class name of my control. The TagPrefix value ensures that there are no naming collisions. For example, I am creating this ImageButton control, but there is already the intrinsic ASP.Net ImageButton control. The ASP.Net control is declared as ASP:ImageButton and with a TagPrefix value of cc1 my ImageButton control will be declared as cc1:ImageButton. By default I also need the runat= server declaration put in.

</Quote>

Bob
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
kandenAuthor Commented:
Thanks
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic.NET

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.