Keep state of Infragistics UltraGrid column swapping (position changed) - c#

I am using Infragistics UltraGridView to display data on a Web form.
Infragistics allows me to swap columns and change the position easily.
The problem I am having is that when there is postback or when my page is auto refreshed, the UltraGrid changes back to its initial position with no column sorting.
I want to keep the column position/state as it is, even if there is postback or auto refresh.
Can anyone help?

Related

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.

Infragistics Grid Selection

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.

DataGridView control scrolls to top when a property changed

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).

Editable, growable DataGrid that retains values on postback and updates underlying DataTable

I'm trying to create an ASP.NET/C# page that allows the user to edit a table of data, add rows to it, and save the data back to the database. For the table of data, I'm using a DataGrid whose cells contain TextBoxes or CheckBoxes. I have a button for adding rows (which works) and a button for saving the data. However, I'm quite stuck on two things:
The TextBoxes and CheckBoxes should retain their values on postback. So if the user edits a TextBox and clicks the button to add more rows, the edits should be retained when the page reloads. However, the edits should not be saved to the database at this point.
When the user clicks the save button, or anytime before, the DataTable underlying the DataGrid needs to be updated with the values of the TextBoxes and CheckBoxes so that the DataTable can be sent to the database. I have a method that does this, but I can't figure out when to call it.
Any help getting this to work, or suggestions of alternative user interfaces that would behave similarly, would be appreciated.
Take a look at the ASP.NET GridView control. It's newer than the DataGrid and has editing features, editing events, etc built in.
Check out the following website:
http://highoncoding.com/Categories/7_GridView_Control.aspx
There are tons of articles on the above link about the GridView control.

Display ASP.NET GridView inside a selected row in another GridView

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

Categories

Resources