Ahh...I think I've got it. I was creating my own array, but so was
asp.net...that's the reason all my objects were not initialized...they were
asp.net's objects (not the ones I created).
It's sort of a complex algorithm to set the user control properties. Can I
call a protected method from the datalist <ItemTemplate>, passing it the
asp.net object, and then let my method set the specific values?
Thanks.
Amil
"Riki" <> wrote in message
news:...
> Amil Hanish wrote:
>> I want to create a bunch of like user controls and display them in a
>> DataList.
>>
>> Does anyone have a GOOD example of how to do this?
>>
>> I thought I had it...I added the user control to my <ItemTemplate>,
>> created an array of user controls in my code behind and set the
>> DataSource and called DataBind. But, all the user controls are
>> unitialized when the page is rendered.
>>
>> Amil
>
> Just put the user control in the template like you would do with any other
> control (e.g. a textbox).
> Bind the properties of the user control that you need.
>
> The DataList will create the "array" of user controls automatically.
>
> The setup of the user control should be done by the user control itself as
> soon as its properties are assigned.
> Whether it is in a template, or just in a page by itself, should not make
> a difference.
>
> --
> Riki
>
|