SaveLayour and CheckedRows array

6 replies. Last post: June 18, 2015 2:53 AM by leo Chandra
Tags :
  • (None)
  • New Discussion
  • New Question
  • New Product Feedback
John BoninMember

Hi,

I am using the SaveLayout functionality to allow user to save the current grid's layout. In most cases it works fine. I do have one problem.

The grid uses a RowChecker column that allows the user to select multiple rows and then do something to all checked rows. It creates an ArrayList of the CheckedRows using:

Dim checkedRows As ArrayList = WebGrid1.RootTable.GetCheckedRows()

If the layout is not saved, the array list (checkedRows) contains a list of all the DataKeyField values for each row (The DataKeyField is set in the RootTable tag). If I save the layout and select a few rows, using the RowChecker column, the array list will contain a list of empty strings. For example if I select 2 rows, the array list will have a count of 2, but the values are empty.

So using the code below, keyValue is an empty string, so gettting the value of a column in the select row returns an error, since keyValue is empty. Again this only fails if I have save/restore the layout. 

For Each keyValue As String In checkedRows
    xname = WebGrid1.RootTable.GetUngrouppedRows().GetRowByKeyValue(keyValue).Cells.GetNamedItem("xName").Text
Next

I've attached the SaveLayout XML files that are created if they help.

Any ideas?




All times are GMT -5. The time now is 7:24 AM.
Previous Next