I had run a contest where each record from the database was shown in a datalist. Now that the contest is over, I want to make sure the winning record is always a different font color to differentiate it from the others and to make it the default selecteditem on the databind. My question is how can I control this one record in my C# code?
Share
Can you hook onto the ItemCreated-event and change the font color in that method maybe?
By looking at e.Item in the DataListItemEventArgs object passed by the framework, you will be able to differentiate the row for the winner from the other rows (given that they are marked in the database with some property, of course).
See DataList.ItemCreated on MSDN for more the event and examples.