I have a DataGrid on a Windows Form and I set the DataSource and DataMember.
Data appears correctly. Question is how can I make certain columns wider to
accomodate the fields. One field is ComapnyName and half of it gets
truncated.
Any help would be appreciated.
Thanks,
Gary
Since nobody answered, I guess it's too complicated or nobody else knows how
to do it?
Why do some posts get answered and others bypassed?
>I have a DataGrid on a Windows Form and I set the DataSource and
>DataMember. Data appears correctly. Question is how can I make certain
[quoted text clipped - 6 lines]
>
> Gary
Jared - 09 Oct 2004 19:35 GMT
Gary,
The datagrid gets rendered as a table, tablerows, tablecells etc. Use
the ItemCreated event to set your widths
Something like this:
For Each tc As TableCell In e.Item.Cells
tc.Width = New Unit("50px")
Next
Jared
> Since nobody answered, I guess it's too complicated or nobody else knows
> how to do it?
[quoted text clipped - 11 lines]
>>
>> Gary
Alex Homer - 09 Oct 2004 22:18 GMT
You said in your message that you were using a Windows Form, even though
this is an ASP.NET (Web Forms) list. If you are using ASP.NET, there are
some options for controlling the size of the cells in a DataGrid shown here:
http://www.daveandal.net/books/6744/webforms/sizemulticontrolgrid.aspx
http://www.daveandal.net/books/6744/webforms/scrollitemgrid.aspx
Hope this helps...
> Since nobody answered, I guess it's too complicated or nobody else knows how
> to do it?
[quoted text clipped - 11 lines]
> >
> > Gary
DCatherman - 11 Oct 2004 15:26 GMT
Check out the DataGridColumnStyle class in helps. I have not figured
everything out yet, but there is a .width property you can assign along
with format and many other styles.
Dave