first time using gridview

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.
 
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,

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

Problem 2 - not a clue.

Thanks.
Ruthie.
 
G

goldie11

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.
 

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

Top