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
- Allow the field header column to take up as much space as it needs without word wrapping.
- 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>
精彩评论