In your Item template, place two Panel controls, each containing the
controls that implement the 2 different layouts you want. Set the Visible
property of both Panels to False.
(You may need to switch to HTML view in order to position the controls
properly, and I have had VS.NET frequently lose the names of controls placed
inside DataGrids and DataList, so be aware of these possible gltiches)
Then, add a Boolean flag variable to the page class and a
DataList_ItemCreated handler and if the flag is false, show the Panel with
the picture and set the flag. If the flag is false then show the other
You will have to use the ugly CType(e.Item.FindControl(panelcontrolname),
Panel) syntax to get to the Panel controls in the DataList.
Since you said that you are displaying a picture in the first row, you could
also do something similar by placing an Image control and a Panel containing
the other controls in the template. Use the flag variable to turn off the
image after the first record.
> I'm having a difficult time finding out if what I want to do is even
> supported by either a datalist or repeater control.
> I have a page that access about ten articles using a datareader. When
> I bind to the control...I need it to display the table row in a
> different format for the FIRST RECORD only. (Basically it will display
> an image) Then the rest of the records have a different layout for the
> table row.
> Is there a way to have two <ItemTemplate>....</ItemTemplate> 's in one
> datalist or repeater and it chooses the template based on the pointer
> of the recordset?