protected override bool LoadPostData(string postDataKey, NameValueCollection postCollection)
{
bool result = base.LoadPostData(postDataKey, postCollection);
string val = postCollection[this.ConfigID.ConcatWith("_SM")];
if (val != null && this.SelectionModel.Primary != null)
{
JsonSerializer serializer = new JsonSerializer();
serializer.MissingMemberHandling = MissingMemberHandling.Ignore;
StringReader sr = new StringReader(val);
if (this.SelectionModel.Primary is RowSelectionModel)
{
SelectedRowCollection ids = (SelectedRowCollection)serializer.Deserialize(sr, typeof(SelectedRowCollection));
(this.SelectionModel.Primary as RowSelectionModel).SetSelection(ids);
}
else if (this.SelectionModel.Primary is CellSelectionModel)
{
SelectedCellSerializable cell = (SelectedCellSerializable)serializer.Deserialize(sr, typeof(SelectedCellSerializable));
if (cell != null)
{
CellSelectionModel sm = this.SelectionModel.Primary as CellSelectionModel;
sm.SelectedCell.RowIndex = cell.RowIndex;
sm.SelectedCell.ColIndex = cell.ColIndex;
sm.SelectedCell.RecordID = cell.RecordID;
sm.SelectedCell.Name = cell.Name;
sm.SelectedCell.Value = cell.Value;
}
}
}
return result;
}
}