Adjusting column width of datagrid in windows form (asp.net + C#)

  • Thread starter Thread starter Therasa
  • Start date Start date
T

Therasa

Hi,
I want to reset the column width of datagrid on runtime. Plz help me
as soon as possible.
 
Sorry got a ahead of myself - Forgot which group I was in!!
You need to add a table style to the DataGrid and You add a
columnstyle for each column - see below:


DataGridTableStyle gridstyle = new DataGridTableStyle();
gridstyle.MappingName = "TableName";
DataGridColumnStyle columnstyle = new DataGridTextBoxColumn();
columnstyle.MappingName = "id";
columnstyle.HeaderText = "Name";
columnstyle.Width = 20;
gridstyle .GridColumnStyles.Add(columnstyle);
dataGrid1.TableStyles.Add(gridstyle );

That should do the trick!

Thanks,
Russ
http://www.cats.co.za
Ultra Rugged, Ultra Reliable Handheld devices
 
Hi Russ,

Thanks a lot for your sample coding . I have tried this coding but in
my PDA mobile application its not working. if you have any other idea
please send me ASAP.

Thanks in advance.

Regards,
Therasa
 
"Not working" is completely *useless* information. If you want help, you're
going to have to do your part: report accurately on what you did and what
the results were!

Paul T.
 

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