在spgridview中设置boundfield的宽度

时间:2013-04-15 14:58:56

标签: sharepoint sharepoint-2010 sharepoint-2007

我尝试了不同的方法来设置gridview clumns的宽度,但没有任何方法可以帮助我。有人可以指导我如何实现这一目标。我在下面包含我的代码......

感谢。

<SharePoint:SPGridView ID="gvSearchResults" EnableViewState="true" runat="server"
                        AlternatingRowStyle-BackColor="#f4f8fd" AllowSorting="true" DataKeyNames="ID"
                        AutoGenerateColumns="false" OnSorting="gvxxxResults_Sorting" OnPageIndexChanging="gvxxxResults_PageIndexChanging">
                        <Columns>
                        <asp:HyperLinkField HeaderText="Name" DataTextField="FileLeafRef"
                                DataNavigateUrlFields="FileLeafRef" Target="_parent" DataNavigateUrlFormatString="/pp/ll/lp/llDocs/{0}"
                                ItemStyle-HorizontalAlign="Left" HeaderStyle-HorizontalAlign="Left" HeaderStyle-Wrap="false"
                                SortExpression="Name" ItemStyle-Width="50px" />
                            <asp:BoundField DataField="Home_x0020_Number" HeaderText="Home Number" NullDisplayText=" " SortExpression="Home_x0020_Number">
                                <HeaderStyle Width="150px" Wrap="false" HorizontalAlign="Left" />
                               <ItemStyle Width="150px" Wrap="false" HorizontalAlign="Left" />
                             </asp:BoundField>
                             <asp:BoundField DataField="Phone_x0020_Number" HeaderText="Phone Number" NullDisplayText=" " SortExpression="Phone_x0020_Number">
                               <HeaderStyle Width="150px" Wrap="false" HorizontalAlign="Left" />
                               <ItemStyle Width="150px" Wrap="false" HorizontalAlign="Left" />
                             </asp:BoundField>


                        </Columns>

                    </SharePoint:SPGridView>

1 个答案:

答案 0 :(得分:0)

您是否尝试过使用SPBoundField控件?尝试设置SPBoundField.ControlStyle.Width属性。