Wrox Home  
Search P2P Archive for: Go

  Return to Index  

aspx thread: Passing Literals into a Web User Control


Message #1 by "Robert Colbert" <rcolbert@n...> on Thu, 28 Feb 2002 18:23:11
OK ... I asked Ben to try and find info about passing variables to an 

ASCX control and I didn't explain myself to him quite right.  The replies 

to his message are helpful in other areas though, so I thank you all for 

that.



Here is what I am trying to do.  I have created a user control that 

implements an ASP:Repeater to build a table of links w/ an adjustable 

template.  I want to pass the dataset to the repeater through the HTML 

side of the calling ASPX page.  You might be wondering why I'd want to do 

it this way.  The answer is fairly simple.  I am building the control for 

a non-programmer to use.  I can teach the end user how to call the 

control and pass it values but don't want to try and teach him how to 

instantiate the control and manipulate it through code.  



Ideally, I would like to implement the control using syntax similar to a 

java applet:

<% @Register TagPrefix="MyControl" TagName="Links" 

Src="~/Controls/Links.ascx" %>

<MyControl:Links runat="Server">

<Link href="http://">Link Description</Link>

<Link href="http://">Link Description</Link>

</MyControl:Links>



Ideally, the <Link> tags would cause an arraylist.add() routine to fire 

adding the entry to the dataset.



I have a workable solution where I can pass an indeterminant number of 

attributes into the control via the inline parameter passing but that 

requires either delimiting the data inside the attribute (I'm using | 

delimiters for that) or passing 2 distinct attributes for each link.  I 

would be happy to share the code if anyone is interested in this.



-Robert

  Return to Index