Skip to content

Instantly share code, notes, and snippets.

@xsolon
Created July 3, 2020 18:54
Show Gist options
  • Save xsolon/594dfdf312ffd3c1f340acd4b4ea6162 to your computer and use it in GitHub Desktop.
Save xsolon/594dfdf312ffd3c1f340acd4b4ea6162 to your computer and use it in GitHub Desktop.
Minimal SpDataSource Sample
<!DOCTYPE html>
<%@ Page language="C#" %>
<%@ Register tagprefix="SharePoint" namespace="Microsoft.SharePoint.WebControls" assembly="Microsoft.SharePoint" %>
<html>
<body>
<form id="form1" runat="server">
<SharePoint:SPDataSource runat="server" DataSourceMode="List" UseInternalName="true"
UseServerDataFormat="true" selectcommand="&lt;View&gt;&lt;/View&gt;" id="spdatasource1">
<SelectParameters>
<asp:Parameter Name="ListName" DefaultValue="Site Pages"/>
</SelectParameters>
</SharePoint:SPDataSource>
<asp:Repeater runat="server" id="Repeater1" DataSourceID="spdatasource1">
<ItemTemplate>
<asp:Literal ID="title" runat="server" Text='<%#Eval("Title") %>'></asp:Literal>
<asp:Literal ID="id" runat="server" Text='<%#Eval("ID") %>'></asp:Literal><br />
</ItemTemplate>
</asp:Repeater>
</form>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment