Close a datagrid?

Can someone tell me how to close a datagrid?

In my app the grid is generated dynamically when a frame is entered. When I leave that frame I need to be able to close the dg.

I have not been able to figure out how to do that and the dg stays on the screen no matter what other frame is accessed.

Thanks.