Auto Ad Code

Friday, July 2, 2010

Setting equal width for TD (column) in Datalist/Checkboxlist

Oftenly we use Datalist or Checkbox list in our code but in result page we don't get the result properly format. i.e. column width is disturbed and frustrated thing is we don't see an option to set the column (td) width.
Ok here is the solution for this

Use style for Datalist/Checkbox list (don't worry if style is not available in HTML editor) as
style="table-layout:fixed;"
e.g.
Datalist

<­asp­:­DataList ID="dList" runat=­"server" RepeatDirection="Horizontal"
RepeatColumns="3" style="table-layout:fixed;"­>

Checkbox list


<­asp­:­CheckBoxList runat=­"server" ID="cblTest" RepeatDirection="horizontal" RepeatColumns="3" style="table-layout:fixed;"­>

3 comments: