Whether the immovable property can be purchased by 'b' legally?

Grandfather purchased an immovable property for his granddaughter some 6 years back from his own source. He got permission to sell the property with the 'consent affidavit' filed by granddaughter's parents before the Court to sell the immovable property to "A" within 3 months from the permission and the sale proceeds should be deposited in the Court. After getting permission from the Court, 'A' declined to purchase. So,'B" come forward to purchase the said immovable property putting a condition that permission to be got in the name of "B" from the Court. Grandfather moved the Court. Court directed the grandfather(Petitioner) to file an petition for condoning the delay in selling the said property. Grandfather(Petitioner) filed the same as directed by the Court. Then the Court returned the original petition stating that 'permission was already granted' and therefore, there is no necessary for further permission and also no need for approval of the draft sale deed in favour of the "B"(new person offered for purchase).Whether "B" can purchase the said property now? If no, please inform the legal remedy. If yes, please, ,inform the same also with supporting legal views.