I am having a hard time understanding your original post. I am not sure what you're trying to say there.
In your code I see a few things wrong. First, you should never be changing values on a prefab like you do when you set the index. You should be doing this on the instantiated object instead.
You are also getting UIGrid then setting a boolean value. You should be calling UIGrid's Reposition() function instead. UIGrid disables itself after completing its task, so you setting a boolean value will do absolutely nothing.
You are also destroying items while iterating through them... this is wrong, and is bad practice. If you want to destroy child objects, use transform.DestroyChildren();