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.
Related
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..
I am using Infragistics Grid in my web application. I have checkbox inside a template field. My grid has a paging too. when I do selection of some rows and go to next page my selection is not persisting. Is there any property which we need to set?. Also I saw that there is Row Selection property but in my case I have a checkbox control inside my grid. How to maintain my selection over paging.?
There is no property which persists selection in the WebDataGrid for pages that are currently not loaded. This is so because the WebDataGrid paging is entirely performed on the server-side and the grid is rebound every time the current page index is changed. The old row objects are disposed and new row objects for the current page are created. Implementation is such for performance reasons.
In order to persist selection, you would have to do a little bit of custom implementation. Keep track of the key of your selected row in code behind, and every time the grid is rebound, check whether the key is present in the current row collection and mark the row as selected.
What is the WPF control I need if I want the user to be able to input Cross Ccy amounts, ie the data needed for each row is
Ccy One, Ccy Two, Amount
I want a grid-like control where the User can enter data for each cell in the row and once you begin to enter data in the cells, a new row gets added underneath, so the control keeps growing with every entry the user inputs and has no upper limit but grows to fit, using a scrollbar when it goes outside the bounds of the grid container.
Is there a built in control to do this? Or do I have to add functionality to listview/datagrid?
If you want the user to be able to add new rows just set the CanUserAddRows property on the DataGrid to true.
<DataGrid CanUserAddRows="True" ..../>
If you want rows the be added when the user edits a data in a cell in an existing row, you can register to one of the cell edit events (depending when you want the new row to be added) and add rows to the grid or items to the collection it is binded to.
datagrid.CellEditEnding += (grid, args) =>
{
datagrid.Items.Add( ....);
};
this is the standard behavior of a datagrid, if the property CanUserAddRows is set to True
On a Windows Form I have a DataGridView control with records that is filled by a data source (data binding). Each record presents a data object.
Not all the rows are displaying: only the first 10 for example. So the user can scroll down to see the another records. Nothing special about this.
But when a user clicks on a row after scrolling, a data property of the object of row is changing and this refreshes the DataGridViewand - it "scrolls" to top of datagrid (maybe the whole DataGridView is refreshing). This is not desirable.
How can I keep the current scroll position during a record update?
You can use the DataGridView's FirstDisplayedScrollingRowIndex property.
It gets/sets the index of the first row displayed on your DGV.
Use it like this:
int rowIndex = dataGridView.FirstDisplayedScrollingRowIndex;
// Refresh your DGV.
dataGridView.FirstDisplayedScrollingRowIndex = rowIndex;
Of course this won't work quite right if sort or add/remove rows to your DGV (you did say you were updating so maybe you're OK).
I have been given a mockup that I do not know is possible to code in ASP.NET without being a real html and javascript wizard.
I want a GridView that when a row is selected, the selected row expands and below the selected row a panel of additional information is shown, which would also include another small GridView. The idea is this would all be in-line. So if the user selected row 4, then the additional information would appear below row 4 and then after the additional information the parent GridView would continue with row 5.
Ultimately I would want to do a multi-select type of set up, but first I need to figure out if this is even possible. Also, the solution must be 508 Compliant
The one solution I considered was using only one "column". Then I would put all my fields in the ItemTemplate, and my detail panel content in the EditItemTemplate and instead of selecting the row, set it to edit mode. The problem with this solution is I lose the functionality of multiple columns if I throw everything in one huge ItemTemplate.
Any and all suggestions or ideas are appreciated.
What you're describing would be best fulfilled with a ListView control. It takes a little more templating work to set up than a grid view, but you have much more control over it and you can emulate the look of a GridView. You would set your Selected Item template to contain another ListView (or GridView) thats bound to your detailed data.
I've done this using a gridview inside a ListView and using ajaxcontroltoolkit collapsible panel
Your parent list would be a listview that would have 2 table rows for each item, on the first row your parent column, on the second row use colspan and add a gridview wrapped on a collapsible panel