Click here to Skip to main content
15,881,757 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I am using DataList control in ASP.net application
C#
DataList1.RepeatColumns = 2;
DataList1.RepeatDirection = RepeatDirection.Horizontal;

When item count is more than 2 it displays items Properly with proper layout.But if it is less than 2 i.e only one item,it expands and occupies some of the second items space also.like..
ABC|ABC for two items and
A B C for one item.
How can I prevent this.Is there any way?
Please Help Me.
Posted
Comments
Er Daljeet Singh 25-Nov-13 1:27am    
try to check when you bind your datalist to some source at that time check whether the source is having record greater than 2 or not.if greater then write
DataList1.RepeatColumns = 2;
else
DataList1.RepeatColumns = 1;
[no name] 25-Nov-13 2:45am    
Its not working
Er Daljeet Singh 25-Nov-13 4:24am    
post your code what you have implemented

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900