Datagrid Column Widths - This should be easier

  • Thread starter Thread starter Tim Nelson
  • Start date Start date
T

Tim Nelson

I am missing something obvious here. I have a simple grid with 2 columns
pulled from an ADO.NET ODBC datasource. All that I want to do is lengthen
the columns in the grid so each field displays completely. Somehow
it appears the order in which you set your grid properties determines
whether
it can get it to work. I know I can write code to do this, but since I was
able
to get the table styles to take effect in design mode (at one point), I know
it's possible.
I have the data set and data adapter already configured.
What to I set first when I build the grid?
The Datasource?
The Tablestyles?
Do I set a mapping name for the table style?
What to I make the Data grid column style mapping name, the column name?

What order do I have to set these things so the column widths I specify in
the
style take effect?
Thanks.
 
Hi Tim
how the datagrid columns are generated ? -if AutoGenerateColumns is False
ok. If not, set it to false and define all the columns you have in html.
let the name of the columns match exactly the names of the columns in your
datasource.

· Write an ItemStyle element with each BoundColumn or TemplateColumns and
set the ItemStyle Width property in pixel (fixed).

· This however if the contents of any cell within that column exceed the
width given, browser will increase the column size automatically. To reduce
its chance you can also set ItemStyle-Wrap to be true.

· Unfortunately, whatever you do, there won't be 100% guarantee of browser
following the width you specify. To make sure though, you need to write
some script that would measure the number of consecutive characters within
a column cell and cut it with a space if it exceed your desired width.
hope that would help
 

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

Back
Top