How to keep records in grid marked after dialog is closed with Cancel button?

I have a RunBase class and I need all marked records to stay marked even after cancel button in dialog is clicked.
I’m trying to do this:

FormDataSource fds;

if (MyClass.prompt())
{
//
}

if(fds)
{
fds.research(1);
fds.active();
while (myTable)
{
fds.findRecord(myTable);
fds.mark(1);
myTable= fds.getNext();
}

}
but only one record is marked after dialog cancel in this way. Please advise, I’m also not sure if that should be fixed in dialog class, may be I should use some form DS method instead?