You can put it in a user control and trigger it with a button. You are getting a null reference exception and most probably pg.Page
is null. This could happen if the page in the query is a Group page. The Group page does not have a PageData which is represented by .Page.
I do not suggest working with the database and touching any tables there. All data is controlled by Open Access ORM and changes to the database are made in case of some issues that cannot be resolved by the API or you need to get some data just to use it on another place.
the Telerik team
Do you want to have your say when we set our development plans?
Do you want to know when a feature you care about is added or when a bug fixed?
Telerik Public Issue Tracking
system and vote to affect the priority of the items