Erik,
You can't use alternating item styles to achieve what you want for the
following reason.
As far as datasource is concerned, datalist has only one column. With using
RepeatColumns=2 you are just arranging the same data column into 2 columns
on the screen. The notion of "AlternatingIte m" refers to every second record
coming from the datasource. In your case you are putting every second record
in another column. That's what you get.
Now, what you should do is to get rid of alternating item styles and use
code-behind PreRender event. In the event handler loop through the datalist
rows and set another background color for every second couple of records.
Eliyahu
"Eirik Eldorsen" <ku*******@hotm ail.com> wrote in message
news:V9******** ************@ne ws.telia.no...
I'm trying to set alternating bgcolor for a datalist with 2 columns. My
problem is that its the alternating cell that get the bgcolor, not the
row. Is it possible to set alternating color of rows?
Here is my code:
<asp:DataList id=dlKommuner runat="server" Width="400px"
RepeatColumns=" 2" CellPadding="3" >
<AlternatingIte mStyle Width="200px" CssClass="arow" >
</AlternatingItem Style>
<ItemStyle Width="200px">
</ItemStyle>
<ItemTemplate >
<asp:Label runat="server" Text='<%# DataBinder.Eval (Container,
"DataItem.Name" ) %>' ID="Label2"></asp:Label>
</ItemTemplate>
</asp:DataList>
Eirik Eldorsen