1

I want know how to use the grid view in a SharePoint-hosted App. Can any one provide information on this?

1 Answer 1

2

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>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.