我的网格包含8个列,其中4列由单选按钮覆盖。 我想按间距平均划分每列,但它不起作用? 我该怎么办?/
<asp:GridView ID="gvRelatives" runat="server" AutoGenerateColumns="False" EmptyDataText="Sorry, No Records Available !" CellPadding="4" ForeColor="#333333" GridLines="None" CellSpacing ="2" onselectedindexchanged="gvRelatives_SelectedIndexChanged" AutoPostBack="True" onrowcreated="gvRelatives_RowCreated" onrowdatabound="gvRelatives_RowDataBound" BorderWidth ="2"
ondatabound="gvRelatives_DataBound" EnableSortingAndPagingCallbacks="False" >
<FooterStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
<RowStyle BackColor="#EFF3FB" HorizontalAlign="center" />
<Columns>
<%--<asp:BoundField DataField="QTN_NO" HeaderText="Question Number" SortExpression="Name" InsertVisible ="false" />--%>
<asp:BoundField DataField="QTN_DESC" HeaderText="Question Description" SortExpression="Name" InsertVisible ="false" />
<asp:BoundField DataField="SQTN_NO" HeaderText="Sub Question No" SortExpression="Name" />
<asp:BoundField DataField="SQTN_DESC" HeaderText="Sub Question Name" SortExpression="Name" />
<asp:TemplateField HeaderText ="Strongly Disagree"></asp:TemplateField>
<asp:TemplateField HeaderText ="Disagree"></asp:TemplateField>
<asp:TemplateField HeaderText ="Agree"></asp:TemplateField>
<asp:TemplateField HeaderText ="Strongly Agree"></asp:TemplateField>
</Columns>
<asp:GridView>
答案 0 :(得分:1)
尝试在每个字段中添加宽度值
<asp:BoundField DataField="QTN_NO" HeaderText="Question Number" SortExpression="Name" Width="100px" InsertVisible ="false"/>
答案 1 :(得分:1)
为每个标题BoundField Element添加宽度。
<asp:BoundField DataField="Title" HeaderText="Title">
<HeaderStyle HorizontalAlign="Center" Width="400"></HeaderStyle>
</asp:BoundField>`