how to set the row number of row for checkboxlist in asp.net? [closed]
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 2 years ago.
Improve this questionI have one checkboxlist with repeat columns=3. If the item count for the datasource of it is less than 20,i need to generate 20 rows with single column.If it is between 21 and 40 then 20 rows and two columns.if it开发者_如何学运维 is between 41 to 60 then 20 rows and 3 columns and for more than 60 records then as normal that checkboxlist behave. Any suggestion is appreciated.
Thanks Mohak
Try this:
int itemCount = <YOUR_DATASOURCE_ITEMS>.Count;
int columnCount = Math.Ceiling(itemCount/20.0)
<YOUR_CHECKBOX_LIST>.RepeatColumns = columnCount;
精彩评论