I want know how to use the grid view in a SharePoint-hosted App. Can any one provide information on this?
1 Answer
You can use built-in server controls in a SharePoint-Hosted app. You just can't use any code-behind. The markup for the various data source and UI controls remains the same.
<SharePoint:SPDataSource ID="SPDataSource1" runat="server"
DataSourceMode="List"
SelectCommand="<Query></Query>" >
<SelectParameters>
<asp:Parameter name="ListName" DefaultValue="Contacts" />
</SelectParameters>
</SharePoint:SPDataSource>
<SharePoint:SPGridView ID="SPGridView1" runat="server"
AutoGenerateColumns="false"
DataSourceID="SPDataSource1">
<Columns>
<SharePoint:SPBoundField DataField="Title" HeaderText="Last Name" />
<SharePoint:SPBoundField DataField="First Name" HeaderText="First Name" />
<SharePoint:SPBoundField DataField="Company" HeaderText="Company" />
<SharePoint:SPBoundField DataField="Business Phone" HeaderText="Work Phone" />
</Columns>
</SharePoint:SPGridView>