By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,835 Members | 1,391 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,835 IT Pros & Developers. It's quick & easy.

Please help - DataGrid

P: n/a
KB
I realised that if I use datagrid and datasource is a
datatable, when I created a new row and while on that row
I exit the datagrid (ie. without moving into the next
row) and focus onto another control, that new row is not
recorded (check it at the datagrid.validating event).
However, if I use down arrow key to move to the next row
(without keying any data) and exit, the new row is
recorded in the datatable.
can anyone please advise if I can force the datagrid row
into the datatable without moving the arrow key ??

Thank you

AH
Nov 20 '05 #1
Share this Question
Share on Google+
4 Replies


P: n/a
Good question. I cant find a way of doing this easily, but I am sure that
there is a way. However, I am interested to know why you would want to add
blank rows to your grid ?

OHM

KB wrote:
I realised that if I use datagrid and datasource is a
datatable, when I created a new row and while on that row
I exit the datagrid (ie. without moving into the next
row) and focus onto another control, that new row is not
recorded (check it at the datagrid.validating event).
However, if I use down arrow key to move to the next row
(without keying any data) and exit, the new row is
recorded in the datatable.
can anyone please advise if I can force the datagrid row
into the datatable without moving the arrow key ??

Thank you

AH


Regards - OHM# On**********@BTInternet.com
Nov 20 '05 #2

P: n/a
Maybe there is a way. On the currentCellChanged event, you can compare the
rowIndex with the rows.count on the bound table. If the row is greater, you
could save it at this point.

Worth a try.

OHM
One Handed Man [ OHM# ] wrote:
Good question. I cant find a way of doing this easily, but I am sure
that there is a way. However, I am interested to know why you would
want to add blank rows to your grid ?

OHM

KB wrote:
I realised that if I use datagrid and datasource is a
datatable, when I created a new row and while on that row
I exit the datagrid (ie. without moving into the next
row) and focus onto another control, that new row is not
recorded (check it at the datagrid.validating event).
However, if I use down arrow key to move to the next row
(without keying any data) and exit, the new row is
recorded in the datatable.
can anyone please advise if I can force the datagrid row
into the datatable without moving the arrow key ??

Thank you

AH


Regards - OHM# On**********@BTInternet.com


Regards - OHM# On**********@BTInternet.com
Nov 20 '05 #3

P: n/a
hi, nice to know that I'm not the only one facing this
problem. re 1st question I did not create a blank row. I
actually key in data but cursor did not leave that row. I
realised it does not create that row in datatable until
you actual move the cursor to next row.

yes .. that could work but i believe that must be a
better way ... could any expert care to help? I do a
validating event and the set focus back to grid and next
validating event will create that row into the
datatable ... strange.. therefore I believe there must be
some event or method that can force the record into the
datatable.

Rgds,

AH

-----Original Message-----
Maybe there is a way. On the currentCellChanged event, you can compare therowIndex with the rows.count on the bound table. If the row is greater, youcould save it at this point.

Worth a try.

OHM
One Handed Man [ OHM# ] wrote:
Good question. I cant find a way of doing this easily, but I am sure that there is a way. However, I am interested to know why you would want to add blank rows to your grid ?

OHM

KB wrote:
I realised that if I use datagrid and datasource is a
datatable, when I created a new row and while on that row I exit the datagrid (ie. without moving into the next
row) and focus onto another control, that new row is not recorded (check it at the datagrid.validating event).
However, if I use down arrow key to move to the next row (without keying any data) and exit, the new row is
recorded in the datatable.
can anyone please advise if I can force the datagrid row into the datatable without moving the arrow key ??

Thank you

AH


Regards - OHM# On**********@BTInternet.com


Regards - OHM# On**********@BTInternet.com
.

Nov 20 '05 #4

P: n/a
I wouldnt swear to it, but this may be how it was intended to work !

OHM

an*******@discussions.microsoft.com wrote:
hi, nice to know that I'm not the only one facing this
problem. re 1st question I did not create a blank row. I
actually key in data but cursor did not leave that row. I
realised it does not create that row in datatable until
you actual move the cursor to next row.

yes .. that could work but i believe that must be a
better way ... could any expert care to help? I do a
validating event and the set focus back to grid and next
validating event will create that row into the
datatable ... strange.. therefore I believe there must be
some event or method that can force the record into the
datatable.

Rgds,

AH

-----Original Message-----
Maybe there is a way. On the currentCellChanged event, you can
compare the rowIndex with the rows.count on the bound table. If the
row is greater, you could save it at this point.

Worth a try.

OHM
One Handed Man [ OHM# ] wrote:
Good question. I cant find a way of doing this easily, but I am sure
that there is a way. However, I am interested to know why you would
want to add blank rows to your grid ?

OHM

KB wrote:
I realised that if I use datagrid and datasource is a
datatable, when I created a new row and while on that row
I exit the datagrid (ie. without moving into the next
row) and focus onto another control, that new row is not
recorded (check it at the datagrid.validating event).
However, if I use down arrow key to move to the next row
(without keying any data) and exit, the new row is
recorded in the datatable.
can anyone please advise if I can force the datagrid row
into the datatable without moving the arrow key ??

Thank you

AH

Regards - OHM# On**********@BTInternet.com


Regards - OHM# On**********@BTInternet.com
.


Regards - OHM# On**********@BTInternet.com
Nov 20 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.