Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / ASP.NET / DataGrid / October 2004

Tip: Looking for answers? Try searching our database.

Setting widths of columns

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Gary Paris - 06 Oct 2004 23:17 GMT
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
Gary Paris - 08 Oct 2004 23:14 GMT
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

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.