Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
180
Behaviors.Selection.SelectedRows is not persisted trough postbacks
posted

I have a 'MessagesGrid'.

 

On a checkedchanged event i get the current row:

 

 

 

 

CheckBox selectedCheckBox = (CheckBox)sender;

 

 

GridRecord row =((GridRecordItem)((Infragistics.Web.UI.TemplateContainer)selectedCheckBox.Parent).Item).Row;

 

 

 

 

 

Then i want to select a row or unselect it:

if (selectedCheckBox.Checked)

{

MessagesGrid.Behaviors.Selection.SelectedRows.Add(row);

}

 

 

else

{

MessagesGrid.Behaviors.Selection.SelectedRows.Remove(row);

}

 

But everytime i get back into my function, the selectrows.count = 0.

Why are the selected rows not persisted between postbacks?

  • 33839
    Verified Answer
    posted

    Hi djmartain,

    If MessagesGrid is a WebHierarchicalDataGrid, you should not be selecting rows on it.  You should select it in the behavior of the grid that the row belongs to.  You should be able to get access to the Grid from the row.  

    regards,
    David Young