Home All Groups Group Topic Archive Search About
Author
8 Aug 2006 4:48 PM
martin1
Hi, All,

can anyone tell me which method/property to add one more row ro gridview?
Thanks,

Author
8 Aug 2006 5:00 PM
Brian Tkatch
martin1 wrote:
> Hi, All,
>
> can anyone tell me which method/property to add one more row ro gridview?
> Thanks,

If it is attached to a DataSource, and the DataSource is a DataTable,
add a row to the DataTable.

Dim Row as DataRow
Row = DataTable.NewRow
DataTable.Rows.Add(Row)

Or compacted: DataTable.Rows.Add(DataTable.NewRow)

B.
Author
8 Aug 2006 5:30 PM
martin1
Hi, Brian,

the datasource is SqlDataSource, how to add new row? can it convert
dataTable? the control i use is gridview for asp page  rather than
datagridview. Thanks

Show quoteHide quote
"Brian Tkatch" wrote:

>
> martin1 wrote:
> > Hi, All,
> >
> > can anyone tell me which method/property to add one more row ro gridview?
> > Thanks,
>
> If it is attached to a DataSource, and the DataSource is a DataTable,
> add a row to the DataTable.
>
> Dim Row as DataRow
> Row = DataTable.NewRow
> DataTable.Rows.Add(Row)
>
> Or compacted: DataTable.Rows.Add(DataTable.NewRow)
>
> B.
>
>
Author
8 Aug 2006 8:25 PM
martin1
Brian,
gridView doesn't have DataTable property. Thanks

Show quoteHide quote
"Brian Tkatch" wrote:

>
> martin1 wrote:
> > Hi, All,
> >
> > can anyone tell me which method/property to add one more row ro gridview?
> > Thanks,
>
> If it is attached to a DataSource, and the DataSource is a DataTable,
> add a row to the DataTable.
>
> Dim Row as DataRow
> Row = DataTable.NewRow
> DataTable.Rows.Add(Row)
>
> Or compacted: DataTable.Rows.Add(DataTable.NewRow)
>
> B.
>
>
Author
9 Aug 2006 12:54 PM
Brian Tkatch
martin1 wrote:
Show quoteHide quote
> Brian,
> gridView doesn't have DataTable property. Thanks
>
> "Brian Tkatch" wrote:
>
> >
> > martin1 wrote:
> > > Hi, All,
> > >
> > > can anyone tell me which method/property to add one more row ro gridview?
> > > Thanks,
> >
> > If it is attached to a DataSource, and the DataSource is a DataTable,
> > add a row to the DataTable.
> >
> > Dim Row as DataRow
> > Row = DataTable.NewRow
> > DataTable.Rows.Add(Row)
> >
> > Or compacted: DataTable.Rows.Add(DataTable.NewRow)
> >
> > B.
> >
> >

Does it have a DataSource property?

B.
Author
9 Aug 2006 5:11 AM
Cor Ligthert [MVP]
Martin,

The GridView, DataGrid, DataGridView are controls made to show data from an
underlying datasource object (as it named now as an intermidiate in VS2005
as well).

In my opinion the best for that is the DataTable or even better its
defaultview (more times to use as the dataview).

In those predifined datasource classes are often multiple methods to add new
rows to a datatable.

Giving a best method is difficult because that depends on your program.

I hope this gives an idea,

Cor

Show quoteHide quote
"martin1" <mart***@discussions.microsoft.com> schreef in bericht
news:2ADF6DBE-550F-4060-9A13-55AE27E262BD@microsoft.com...
> Hi, All,
>
> can anyone tell me which method/property to add one more row ro gridview?
> Thanks,
>