本文介绍了如何为特定的列和标题指定特定的宽度的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何为特定的列和标题指定特定的宽度
请告诉我我想指定任何地址或名称的FIX宽度
我应该使用哪个属性
How to specify specific width to specific column and heading
please tell me i want to specify FIX width of any address or name
which property i should use
<asp:GridView ID="grdsearch" runat="server" AutoGenerateColumns="False"
onrowcreated="grdsearch_RowCreated"
onrowdeleting="grdsearch_RowDeleting" DataKeyNames="cust_id"
Width="750px">
<Columns>
<asp:BoundField DataField="cust_id" HeaderText="Customer Id"
ItemStyle-Width="200px" ItemStyle-VerticalAlign="Middle" >
<ItemStyle VerticalAlign="Middle" Width="200px" />
</asp:BoundField>
<asp:BoundField DataField="cust_name" HeaderText="Customer Name"
ItemStyle-Width="200px" ItemStyle-VerticalAlign="Middle" >
<HeaderStyle Width="30%" />
<ItemStyle VerticalAlign="Middle" Width="40%" />
</asp:BoundField>
<asp:BoundField DataField="cust_address" HeaderText="Address"
ItemStyle-Width="200px" ItemStyle-VerticalAlign="Middle" >
<HeaderStyle Width="500px" />
<ItemStyle VerticalAlign="Middle" Width="700px" Wrap="False" />
</asp:BoundField>
<asp:BoundField DataField="cust_city" HeaderText="City" ItemStyle-Width="200px"
ItemStyle-VerticalAlign="Middle" >
<ItemStyle VerticalAlign="Middle" Width="200px" />
</asp:BoundField>
<asp:BoundField DataField="cust_telephone" HeaderText="Telephone"
ItemStyle-Width="200px" ItemStyle-VerticalAlign="Middle" >
<ItemStyle VerticalAlign="Middle" Width="200px" />
</asp:BoundField>
<asp:BoundField DataField="cust_email" HeaderText="Email Id" />
<asp:BoundField DataField="sales_contact_prsn"
HeaderText="Sales Contact Person" />
<asp:BoundField DataField="sales_mob_no" HeaderText="Sales Mobile Number" />
<asp:CommandField ShowDeleteButton="True" ButtonType="Button"
HeaderText="Delete" />
</Columns>
<RowStyle Wrap="False" BorderWidth="10px" />
<SelectedRowStyle CssClass="grdselectback" />
</asp:GridView>
推荐答案
<FooterStyle Width="112px" /> <HeaderStyle Width="112px" /> <ItemStyle Width="112px" />
Kaushik
Kaushik
ItemStyle-Width="5%" ItemStyle-Wrap="true"
确保所有列的宽度之和应等于GridView的宽度.
希望这对您有帮助...
Make sure that sum of all columns width should be equal to width of GridView.
Hope this will help you...
这篇关于如何为特定的列和标题指定特定的宽度的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!