GridView BoundField Width

M

mohaaron

Why does it seem like is impossible to set the width of a BoundField
in a GridView. I've tried all sorts of different way to set the width
and none of them work. So far the only thing I've done that has worked
is to set the Wrap property to false which is not what I want do.

Can anyone tell me now to set the column width of a GridView in the
aspx file code?
 
P

Paul Shapiro

This works in a DetailsView so I think it should in a GridView:
<asp:BoundField DataField="YourFieldName" HeaderText="Your Field
Label" SortExpression="YourFieldName" >
<ControlStyle Width="500px" />
<ItemStyle Width="500px" />
</asp:BoundField>
 
M

mohaaron

I just tried the following and it doesn't work.

<asp:BoundField DataField="Comments" HeaderText="Comments"
SortExpression="Comments" >
<ControlStyle Width="500px" />
<ItemStyle Width="500px" />
</asp:BoundField>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,069
Latest member
SimplyleanKetoReviews

Latest Threads

Top