I have a Hierarchical gridview and I need implement the following functionality in the child gridview:
Show all the rows in editable mode (this can be done)
Save all data of each row on it's lost focus
We can capture the mouse events but how do we track the row lost focus triggered by the Keyboard. Ex: when a row is in focus, hitting f6 will go directly to browser address bar which results in the row lost focus event.
One mouse move across the rows will trigger all the validation and save logic for all the rows, this screen has hierarchical control and the child gridview has a minimum of 200 rows.
Any thoughts on how to implement this?
You'd probably need to implement a postback / callback when the blur event fires for the row on the client-side. I'm not exactly sure which DOM elements support the blur event in every browser but you can do it.
The GridEX control from Janus Systems can do it, but honestly, I'd really stay clear of doing things like Janus Systems do, so it's better you should find your own way.
EDIT: Try this.
Related
I have a rather simple sounding requirement. Currently, we have a Combobox which is rather inefficient because it attempts to load all the data from DB when the box is clicked. This Combobox is not typable and all I have to basically do is ensure that the data is loaded in chunks at the appropriate times i.e. when the user is at or near the end of the Combobox.
My initial thought was that there should be an event which I could bind to when the user scrolls towards the end of the Combobox, but no such event exists based on what I could see in event list.
My alternative solution is to bind on mouse wheel down event and have a method which constantly polls whether the last item is visible (although I'm not sure such property exists) and if it is, load more data.
My last hunch is that there should be some sort of asynchronous stream data approach to this problem which would just basically load rows without locking up the UI continuous instead of one big chunk.
Can anyone suggest anything and maybe show a quick demonstration?
Kind regards,
Vocal.
I am working on implementing a WPF Datagrid and I have a requirement where a record in the grid must always be selected. I have set the SelectionMode=Single and SelectionUnit=FullRow. However if i click and drag a given record while pressing control i am able to enter a state where the grid no longer has a selected value. It looks like by pressing control i am able to get the record to deselect. I have tried handling the preview key down event and setting handled to true when the control key is pressed but it seems to be an order of operations issue between click/dragging the records and the control key being pressed. Ultimately i would like to just disable the whole click/drag the grid selection, but i am coming up short on that one. I am trying to keep this as clean as possible. Does anyone have any experience with this?
To be clear I'm talking about Grid - not GridView or DataGrid or anything like that.
All I found online was about GridView and such.
I want to be able to select items with a mouse click or drag from a Grid.
What I have is a table filled with text implemented through a Grid. I want to be able to select "cells" in the Grid.
The reason I don't use DataGrid is because I couldn't find a way to set a cell's span.
Thank you,
Dolev.
I had nearly the same approach some month ago: Dynamic ui with rows and columns
Maybe this will help you.
In the end I used Selector.IsSelected attached property.
Selector Class
I modified the MouseDown, MouseUp, MouseMove event to record a rectangle created when dragging the mouse while the left button is held. Then I checked which cells are within that rectangle.
As a double check to see that the cell is really selected I used Selector.SetIsSelected and Selector.GetIsSelected.
I was working on a c# project using a DataGridView and ran into an issue.
Basically, I have a grid that gets updated from any number of places and has a button column.
I want to capture button clicks (of course) and do something which involves the other cells from that button's row. As far as I know, the only way to associate a click with a row of the grid is via the RowIndex of the EventArgs.
What I'm worried about is that the grid may change between the user clicking and the event being delivered, causing an incorrect row to look like it was clicked.
Can this happen or am I being paranoid? If possible, is there anyway I can bind a reference to either the button or the row inside the eventargs so that I can differentiate the originating row even if its index has since changed?
GUI controls in WinForms are 'tied' to the UI thread.
When you click the row, grid implementation handles this and as a part of the click handling raises an event - all on the same UI thread. Even if other threads change the grid content, this has to be serialized to the UI thread (typically with posting Windows messages in the background, or BeginInvoke in WinForms terminology - not exactly the same, but close).
This means that even if there are concurrent changes, if your click is already registered, the event will not be interrupted by UI update.
Note, however, that background thread could change the data object to which the row is bound while your handler runs, or between click occurred and event was handled. Still, it makes no difference to you, as grid UI update would need to be serialized and would still happen after your event handler.
i want to create a custom control (like UITableView in iPhone) in .Net using c sharp so user can scroll using mouse or keyboard navigation keys. I also want to create event when user click on any row. Currently the possible control is Datagridview which seems to me correct but i want to know the other possible approaches. So please suggest or advice other alternative
The DataGridView does sound like it might fit your simple requirements, you can certainly scroll using the mouse or keyboard. Also there is the CellMouseClick which is fired when the user clicks the grid. This reports row and column index.
However, the iPhone UITableView is not multi-column. If you do not heen a grid-like layout (rows and columns), then DataGridView is overkill. You might want to consider ListBox instead. This has a SelectedIndexChanged event which can be used to detect row clicks.