views:

28

answers:

1

I have a datalist binded through sql datasource which displays image and its name, now I want to edit each item and want to add some description with it. Is it possible to do it in the aspx pag itself I mean I don't want to bind the description through datasource. Below is the code

<asp:SqlDataSource ID="SqlDataSource1" runat="server" 
            ConnectionString="<%$ ConnectionStrings:PicWash %>" 
            SelectCommand="SELECT [FileName], [FilePath] FROM [tblFiles]">
        </asp:SqlDataSource>

        <asp:DataList ID="DataList1" runat="server" DataSourceID="SqlDataSource1" 
            Height="1208px" Width="457px">        
            <ItemTemplate>
                FileName:
                <asp:Label ID="FileNameLabel" runat="server" Text='<%# Eval("FileName") %>' />
                <br />
                FilePath:                
                <asp:Image ID="Image1" runat="server" ImageUrl = '<%# Eval("FilePath")%>' Height="200px" Width="400px" />
                <br />
                <br />
            </ItemTemplate>        
        </asp:DataList>

there are 9 items in the datasource I want to add some description with each item. How can I do it?

+1  A: 

In the Code Behind page you can use the ItemDataBound event to modify the contents of each item.

Shawn Steward