views:

52

answers:

1

I have made some progress with the DataList and UserControl this morning but I still try to figure out how I could improve my code (everything work but the GUI is not yet what desired).

In the ASPX file I have something like that :

    <asp:DataList ID="dlSpeechBubble" runat="server">
        <ItemTemplate>
            <CSVSMS:Bubble ID="singleSpeechBubble" runat="server" CurrentDataItem="<%# Container.DataItem %>"/>
        </ItemTemplate>
    </asp:DataList>

Every object bind well but the problem is that I need the user control to act differently depending of the value of the previous Data is compared to its value.

Where in ASP.NET does the logic between item goes? In PHP I would have do a loop and check with an index -1 and compare value... but how can I do it in ASP.NET?

+1  A: 

Datalist does have events like ItemCreated and ItemDataBound that you can code to in the code behind.

If I understand correctly you want to modify an item based on a previous item? Why not create a user control which is populated from a DataTable or DataSet - adding each control to a placeholder on your page? That way you can use your loop.

I am new to .Net for "web side" and I thought that if I had a list of object the "good" way to do it was with a DataList and a usercontrol that has the "shape" of the container of the information. But now I realize that thee "container" require to be modified depending of what was the previous value. Can you provide me a link with an example?
Daok