I insert a custom webpart in the page, It's working good. But when I click in edit page I find the webpart is deleted!
What is going on?
Check out this related answer.
There is a trick you can use to get your web part back. Select the checkbox next to the web part and click on the option to close the web part. This will place the web part in the closed web parts gallery and you will be able to re-add the web part to the site. Once you close the web part it will be added to the Closed Web Parts gallery. The closed web parts gallery can be accessed by adding a new web part to the page. You will see it at the bottom of the menu (if you have any closed web parts on the page). You can select and add this web part back to the page and it will add the web part that was lost when you were editing the settings
How can I make this not happen?
So far the best thing I have come across that keeps this from happening is to add the web parts to the page and save the page before editing any of the web part settings.