开发者

ASP.Net: Setting the width for DetailsView

I am using a DetailsView control with a field that has a large amount of HTML text. The rendered page displays the DetailsView data column with a very narrow width. What I'd like to be able to do is

  1. Allow the field header column to take up as much space as it needs without word wrapping.
  2. Allow the data column to take up the rest of the space (or upto a specified %) of the remainin开发者_运维技巧g space on the page.

How can I do these two aspects?

Many thanks.


Here is an example of the DetailsView source

<asp:DetailsView ID="DetailsView1" runat="server" AutoGenerateRows="False" 
        CellPadding="4" DataKeyNames="C_id" DataSourceID="EntityDataSource1" 
        ForeColor="#333333" Height="50px" Width="100%" AllowPaging="True">
        <AlternatingRowStyle BackColor="White" ForeColor="#284775" />
        <CommandRowStyle BackColor="#E2DED6" Font-Bold="True" />
        <EditRowStyle BackColor="#999999" />
        <FieldHeaderStyle BackColor="#E9ECF1" Font-Bold="True" Width="40%"/>

You will notice the width for the DetailsView is set to 100%, then just change the % width of the field headers to how much screen retail you'd like them to use.

You will also need to change each controls width accordingly with ControlStyle-Width="whatever percent or size"

Hope that helps! Greg


Use CSS Add a style that sets all input tag's width to 100%

<style type="text/css">
input {width:100%;}
</style>
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜