first time using gridview

  • Thread starter Thread starter goldie11
  • Start date Start date
G

goldie11

Hi,

This is the first time I use a gridview.
I have two big problems:

1) I need to assign the columns of the gridview from the code (the cs
file )- because the assignment of the columns depends on the user.
Different users see different columns.

2) There is a dataTable column that I need to convert in the code
before showing it - from number to specific text. Where do I do the
conversion ? The gridview datasource contains, as I understand, only
one datasource.

I hope that I am clear.
Mayby someone has an idea?
Thanks.
Ruthie.
 
Hi,

This is the first time I use a gridview.
I have two big problems:

1) I need to assign the columns of the gridview from the code (the cs
file )- because the assignment of the columns depends on the user.
Different users see different columns.

2) There is a dataTable column that I need to convert in the code
before showing it - from number to specific text. Where do I do the
conversion ? The gridview datasource contains, as I understand, only
one datasource.

I hope that I am clear.
Mayby someone has an idea?
Thanks.
Ruthie.

Hi,

Problem 1 is solved by using -
grid1.ColumnFields.Add(field);

Problem 2 - not a clue.

Thanks.
Ruthie.
 
2) do it in RowDataBound event. It fires as the rows get bound to the data
source. At this stage you can access the values of all columns and process
them as needed.

--
Eliyahu Goldin,
Software Developer & Consultant
Microsoft MVP [ASP.NET]http://msmvps.com/blogs/egoldinhttp://usableasp.net




This is the first time I use a gridview.
I have two big problems:
1) I need to assign the columns of the gridview from the code (the cs
file )- because the assignment of the columns depends on the user.
Different users see different columns.
2) There is a dataTable column that I need to convert in the code
before showing it - from number to specific text. Where do I do the
conversion ? The gridview datasource contains, as I understand, only
one datasource.
I hope that I am clear.
Mayby someone has an idea?
Thanks.
Ruthie.- Hide quoted text -

- Show quoted text -

Dear Eliyahu,

Thanks so much for your help.

Your help, as always, solved the problem.

Best Regards,
Ruthie.
 
Back
Top