* copy from any application page from layouts/
* delete all contents in <asp:Content id="PlaceHolderMain" >
*change the page inheritance to: Microsoft.SharePoint.WebControls.LayoutsPageBase
*Find the buttons template section:
<Template_Buttons>
<asp:Button UseSubmitBehavior="false" runat="server"
class="ms-ButtonHeightWidth" OnClick="BtnUpdateWeb_Click"
Text="<%$Resources:wss,multipages_okbutton_text%>" id="BtnCreate"
accesskey="<%$Resources:wss,okbutton_accesskey%>"/>
</Template_Buttons>
* Define OnClick function.
<script runat="server">
protected void BtnUpdateWeb_Click(object sender, EventArgs e) { ...}
</script >
*Note: The above template also defines both "OK" and "Cancel" buttons on the page.
by now, it should be a functioning application page, and you can load ClientOM by adding the follwoing in any asp:content:
<SharePoint:ScriptLink runat="server" Name="sp.js" OnDemand="true" Localizable="false" />
Then you can use ClientOM in any javascrip such as:
function retrieveWebSite() {
var clientContext = new SP.ClientContext.get_current();
this.oWebsite = clientContext.get_web();
clientContext.load(this.oWebsite); //this is to make oWebSite available in client
oWebSite........
clientContext.executeQueryAsync(...)
}