后端cs:数据绑定:
user_CheckBoxList.DataTextField = "limit3_name";
user_CheckBoxList.DataValueField = "limit3_id";
user_CheckBoxList.DataTextFormatString = " "+"{0: S}";
user_CheckBoxList.DataSource = ds.Tables[i].DefaultView;
user_CheckBoxList.DataBind();
未设置前效果:勾选框与文字之间紧挨着,看着不美观

设置后效果:勾选框与文字之间,稍微间隔一两个空格

前端aspx:行间距离设置:CellSpacing="10"
<asp:CheckBoxList ID="user_CheckBoxList" runat="server" RepeatLayout="Table" CellSpacing="10"></asp:CheckBoxList>
这篇博客介绍了如何通过设置后端CS的数据绑定属性和前端ASPx的行间距离参数来改善CheckBoxList的显示效果。通过调整DataTextField、DataValueField和DataTextFormatString,以及设置CellSpacing属性,实现了勾选框与文字之间增加适当间隔,提高UI美观度。
3314





