1

我有一个包含 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>
4

2 回答 2

1

尝试在每个字段中放置一个宽度值

      <asp:BoundField DataField="QTN_NO" HeaderText="Question Number" SortExpression="Name" Width="100px" InsertVisible ="false"/>
于 2012-05-06T00:11:05.550 回答
1

Add width to each header BoundField Element.

<asp:BoundField DataField="Title" HeaderText="Title">  
<HeaderStyle HorizontalAlign="Center" Width="400"></HeaderStyle>
</asp:BoundField>`
于 2013-11-27T02:52:22.227 回答