?
Solved

Custom Control HELP

Posted on 2006-04-03
10
Medium Priority
?
220 Views
Last Modified: 2010-04-23
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
0
Comment
Question by:kanden
  • 5
  • 5
10 Comments
 
LVL 96

Expert Comment

by:Bob Learned
ID: 16366922
Not enough information here.  What is MyParameter?  A collection?

Bob
0
 

Author Comment

by:kanden
ID: 16367421
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
 
LVL 96

Expert Comment

by:Bob Learned
ID: 16370159
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
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 

Author Comment

by:kanden
ID: 16371049
"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
 
LVL 96

Expert Comment

by:Bob Learned
ID: 16371078
In the control project, is there a class called 'Parent', and one called 'Child'?

Bob
0
 

Author Comment

by:kanden
ID: 16371123
No,

this is hypothetical.

The ultimate goal is to understand what is going on.
0
 
LVL 96

Expert Comment

by:Bob Learned
ID: 16371159
>>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
 

Author Comment

by:kanden
ID: 16371184
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
 
LVL 96

Accepted Solution

by:
Bob Learned earned 1500 total points
ID: 16371225
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
 

Author Comment

by:kanden
ID: 16371262
Thanks
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Article by: jpaulino
XML Literals are a great way to handle XML files and the community doesn’t use it as much as it should.  An XML Literal is like a String (http://msdn.microsoft.com/en-us/library/system.string.aspx) Literal, only instead of starting and ending with w…
If you're writing a .NET application to connect to an Access .mdb database and use pre-existing queries that require parameters, you've come to the right place! Let's say the pre-existing query(qryCust) in Access takes a Date as a parameter and l…
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an anti-spam), the admin…
In a question here at Experts Exchange (https://www.experts-exchange.com/questions/29062564/Adobe-acrobat-reader-DC.html), a member asked how to create a signature in Adobe Acrobat Reader DC (the free Reader product, not the paid, full Acrobat produ…
Suggested Courses

840 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question