Datagrid annoyance

Z

zdrakec

Hello all:

This is a new one on me...

I have a datagrid, bound to a disconnected datatable (actually a
dataview flaked off of that table), to which my user is able to add new
records.
1) When I click on the * for a new row, it takes a long time for the
new row to appear.
2) Any value I enter into any column gets changed back to DBNull as
soon as I click or tab off of that column.

I have created many an editable datagrid, in exactly the same manner as
I am doing now, but have never had this problem, and after much poking
about I must admit I have no idea what the hell is going on.

The columns are defined as readonly=false both at the datatable level
and at the gridcolumnstyle level. The grid itself has readonly=false. I
explicitly set AllowEdit and AllowNew to true for the dataview.
The dataview sees that I'm trying to add a row at runtime, but of
course, the various data items contain dbnull when I am looking at it
at debug time.

Ideas?

Thanks much,
zdrakec
 
Z

zdrakec

Sorry, I just fixed it...naturally I thought of one more thing after,
not before, I posted...
I have some labels also bound to the dataview (text property), and one
of the fields is a date field, which I am formatting by adding a
handler to the databindings("text").format event. This handler goes:

e.Value = CType(e.Value, DateTime).ToString("MM/dd/yyyy")

which was causing a problem when the row was a new row. I have changed
it to:

If dataview.Item(datagrid.CurrentCell.RowNumber).IsEdit Then Exit Sub
e.Value = CType(e.Value, DateTime).ToString("MM/dd/yyyy")

and everything appears to be all better now.

Thanks,
zdrakec
 

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