datagridview pans on clicking a cell - c#

I have a winforms application that has a datagridview control. Now, when I click on a cell in the datagridview control, the view shifts/pans the datagridview control, such that the cell selected is more or less in the centre of the screen. Is there any way to disable this? My users find this irritating.
The data gridview is essentially needed only to show colour codes (i.e. no text) and tooltips for each cell. I have tried
datagridView1.Enabled = false;
This solves my problem, however, I can no longer view the tooltip text.
Is there any other work-around? Is it possible to prevent the user from clicking on a cell in the first place to prevent this?

Related

Telerik RadGrid SelectionChanging Event Leaving Partial Selected Row

I am more of a web developer, but I was recently asked to look at a WinForms application.
What I have is a Telerik WinForms RadGridView. When I click on a row, and the SelectionChange event is fired.
Within this event, pop-up a quick MessageBox to display a Yes/No confirmation if the data in the row has changed.
This is working using the following code:
So when the line
e.Cancel = true;
is executed, it acts as
$("a").click(function(event){
event.preventDefault();
});
in javascript.
The unfortunate issue that I have, is when the screen renders, the newly selected row is still highlighted and I do know how to stop this.
I have looked at the RadGridView object model and found IsActive and IsSelected attributes, but nothing appears to stop this from happening.
Looking at the image, The row with the blue bar was selected, then on selecting the cell above, showing the cell in blue and the row with a blue border. I clicked on the cancel option which passed a DialogResult.Cancel back from the warning message.
This executed the line
e.Cancel = true;
What do I need to do, to lose the blue border and blue cell colour from the selected row?

break in refreshing my custom combo box column in RadGridView

I have created a custom grid column for a RadGridview which based on the row DataItem which is a class, finds the corresponding items and put them in the Combobox.
When the page loads, the custom column is freeing to be created only for the rows that are in visual and for other rows, it has been fired to be created when the user scrolls down. Unfortunately, when the user scroll the wrong combo boxes are created for each row.
For example, run the below sample and see the combobox in front of dimensionless row, which must be empty which is correct. Now scroll down and click on a cell and scroll up to the dimension row, which now have a Combobox with values which is erroneous. Note that the dimensions combo box is shifted up now!
Why the combo boxes are wrong after scrolling or windows size change?
It is Virtualization which is causing the behaviour you describe.
You can disable this on a RadGridView like so:
EnableRowVirtualization="False"
This will cause all your data to load whether it's in view or not, and if you have a lot of data this can cause significant performance issues.

Value is textbox disappears after it comes back to view

I have a datagrid, where I have styled the column headers to have a textbox in them so that I can perform filtering.
I enter some text in the textbox of the last column, then resize my window such that I will no longer see the last column. After that I resize my window again to show the last column. The value in the textbox disappears - as if the textbox control is regenerated again.
How can I retain the value?
Disabling column virtualization solved the problem for me..

Adding a control to Cells of a datagridview column

Just a quick question about adding a control to a Datagridview cell when the user clicks it. I want to add either a button or an open dialog button to a cell once the user clicks it. I have the column headers populated from a string array and the rows populated with another. I found this article on hosting controls in a datagridview cell but I'm confused by it as it adds a datetimepicker whereas I only want a open dialog button or regular button. Is there any other good informative articles online? I did research it but couldnt find muc...
Thanks for the help.

How to make popup window appear when double click on a cell in datagrid

I have a data grid displaying results from a sql database. What I want to do is make it so that when I double click on a cell in the datagrid, a new window appears where that cell can be edited. I also would like to have all the info for that cell to be autogenerated into editable fields when the cell is double clicked. Any help or links to tutorials is appreciated. Thanks.
Add an onclick event that opens the window to the cell (using datagridview would be a good idea I think).
In addition, you you just want them to edit the cell contents, you can let the control handle all that for you (enable editing, adding, deleting, etc if you want).
http://msdn.microsoft.com/en-us/library/system.windows.forms.datagridviewcell.onclick.aspx

Categories

Resources