Datagrid Programmatic

  • Thread starter Thread starter Hai Nguyen
  • Start date Start date
H

Hai Nguyen

Hi everyone

I have to generate a bunch of datagrids. The # number of datagrids needed
will be told by a method.
That's why I have to build an array of datagrids

.....
Datagrids[] grids = new Datagrids[numberofgrids];

// initialize grids ....
.....

Everything works find. The only question I would like to know why after I
creat each datagrid programatically, I can not see it.

Did I miss something? Please instruct me.

Thanks
 
a datagrid only makes an appearance when and only when it contains bound
data. you will have to bind to the new datagrid to get them to show up
 
Which DataGrid are you talking, Win Form or Web control?

If it is win form, besides you "new" to create instance(s) of DataGrid, you
also have to add the instatnce(s) to a container control, such as Form or
Panel, by calling Controls.Add() or Controls.AddRange(), in order for the
DataGrid(s) to visibly show.
 
Sorry, I thought I was in another NG. This IS asp.net NG, so the DataGrid is
web one.

Norman Yuan said:
Which DataGrid are you talking, Win Form or Web control?

If it is win form, besides you "new" to create instance(s) of DataGrid, you
also have to add the instatnce(s) to a container control, such as Form or
Panel, by calling Controls.Add() or Controls.AddRange(), in order for the
DataGrid(s) to visibly show.

Hai Nguyen said:
Hi everyone

I have to generate a bunch of datagrids. The # number of datagrids needed
will be told by a method.
That's why I have to build an array of datagrids

....
Datagrids[] grids = new Datagrids[numberofgrids];

// initialize grids ....
....

Everything works find. The only question I would like to know why after I
creat each datagrid programatically, I can not see it.

Did I miss something? Please instruct me.

Thanks
 
Back
Top