At last I put it in App_Code then I got new error
Exception Details: System.Web.HttpException: Content controls have to be top-level controls in a content page or a nested master page that references a master page.
It was due to <asp:content runat=server I missed to put runat= server attribute to it so I was getting that error. Now it is resolved.
thanks...