DataGridView unbound cells loose content

R

Rainer Queck

Hi NG,

Why is it, that in my DataGridView all columns which are not bound to
a "DataProperty" loos thier content in a couple of occasions?

This happens if:
- Underlaying DataSet.AcceptChanges()
- DataGridView bound columns -> Click on header for sorting

Is there a event, that I can use to detect this situation and then
"refill" my unbound DataGridViewColumns?

I this propably a bug in the DGV?

Thanks for Help and Hints
Rainer
 
L

Linda Liu [MSFT]

Hi Rainer,

Thank you for posting.

When you display unbound columns along with the bound columns, this is
sometimes called "mixed mode". Because unbound columns are outside the data
source, they are ignored by the data source's sorting operations.
Therefore, when you enable sorting in mixed mode, you must manage the
unbound data in a local cache and implement virtual mode to let the
DataGridView control interact with it.

For more information on how to implement virtual mode, you may refert to
the example in the following link.

http://msdn2.microsoft.com/en-us/library/ms171622(d=ide).aspx
http://msdn2.microsoft.com/en-us/library/system.windows.forms.datagridviewch
eckboxcolumn.threestate(d=ide).aspx

Hope this helps.
If you have anything unclear, please don't hesitate to let me know.


Sincerely,
Linda Liu
Microsoft Online Community Support

====================================================
When responding to posts,please "Reply to Group" via
your newsreader so that others may learn and benefit
from your issue.
====================================================
 
R

Rainer Queck

Hello Linda,

thank you for responding.

Linda Liu said:
When you display unbound columns along with the bound columns, this is
sometimes called "mixed mode". Because unbound columns are outside the
data
source, they are ignored by the data source's sorting operations.
Therefore, when you enable sorting in mixed mode, you must manage the
unbound data in a local cache and implement virtual mode to let the
DataGridView control interact with it.
This sound logical.
Is it possible to disable sorting, to keep the content of my unbound colums?

For more information on how to implement virtual mode, you may refert to
the example in the following link.

http://msdn2.microsoft.com/en-us/library/ms171622(d=ide).aspx
http://msdn2.microsoft.com/en-us/library/system.windows.forms.datagridviewch
eckboxcolumn.threestate(d=ide).aspx
I will have a look.

Regards
Rainer Queck
 
L

Linda Liu [MSFT]

Hi Rainer,

Thank you for your quick response.

Yes, you could disable sorting by setting the SortMode property of the
columns in the DataGridView to NotSortable.


Sincerely,
Linda Liu
Microsoft Online Community Support

============================================================================
=============================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif
ications.

With newsgroups, MSDN subscribers enjoy unlimited, free support as opposed
to the limited number of phone-based technical support incidents. Complex
issues or server-down situations are not recommended for the newsgroups.
Issues of this nature are best handled working with a Microsoft Support
Engineer using one of your phone-based incidents.

============================================================================
=============================================
This posting is provided "AS IS" with no warranties, and confers no rights.
 
R

Rainer Queck

Hi Linda,

thanks once more for your answert.
Yes, you could disable sorting by setting the SortMode property of the
columns in the DataGridView to NotSortable.
I decided to make use of the virtual mode, but I will keep that in mind.

Thanks
Rainer
 
L

Linda Liu [MSFT]

Hi Rainer,

How is it going with implementing virtual mode in your program? If you have
any questions, please feel free to post in the newsgroup and we will follow
up.

Thank you for using our MSDN Managed Newsgroup Support Service!


Sincerely,
Linda Liu
Microsoft Online Community Support

============================================================================
=============================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif
ications.

With newsgroups, MSDN subscribers enjoy unlimited, free support as opposed
to the limited number of phone-based technical support incidents. Complex
issues or server-down situations are not recommended for the newsgroups.
Issues of this nature are best handled working with a Microsoft Support
Engineer using one of your phone-based incidents.

============================================================================
=============================================
This posting is provided "AS IS" with no warranties, and confers no rights.
 
R

Rainer Queck

Hi Linda,

thanks for checking back on me.
I have now solve my DGV - unbound cell problems by using the virtual mode.
Works fine!

Regards
Rainer
 
L

Linda Liu [MSFT]

Hi Rainer,

Thank you for your update. I'm very glad to hear that you have solved the
problem.

If you have any other questions in the future, please don't hesitate to
contact us. It's always our pleasure to be of assistance.


Sincerely,
Linda Liu
Microsoft Online Community Support

============================================================================
=============================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif
ications.

With newsgroups, MSDN subscribers enjoy unlimited, free support as opposed
to the limited number of phone-based technical support incidents. Complex
issues or server-down situations are not recommended for the newsgroups.
Issues of this nature are best handled working with a Microsoft Support
Engineer using one of your phone-based incidents.

============================================================================
=============================================
This posting is provided "AS IS" with no warranties, and confers no rights.
 

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

Similar Threads


Top