I would like to know how to show a list of sharepoint in a page of asp.net c # by means of a datagridview and be able to modify it by adding a record to the list by means of a button.

Beforehand thank you very much!!

I thank you for your prompt reply Mohamed El-Qassas but I already did this, what I want now is to bring a list created in online sharepoint to a datagrid of a page of asp.net bone to make a maintenance of records what I add, modify or delete in that datagrid by means of buttons do it also in the online sharepoint

I want something like that for example:

enter image description here


You should use the Client Side Object Model to interact with SharePoint Online from your ASP.Net App.

First, you should add the below references to your solution

  • Microsoft.SharePoint.Client.dll
  • Microsoft.SharePoint.Client.Runtime.dll

Add List Item

string WebUrl = "https://You.sharepoint.com/sites/ABC/";
string login = "**********";
string password = "**********";
var securePassword = new SecureString();
foreach (char c in password)
var onlineCredentials = new SharePointOnlineCredentials(login, securePassword);

#region Insert the data
using (ClientContext CContext = new ClientContext(WebUrl))
CContext.Credentials = onlineCredentials;
List announcementsList = CContext.Web.Lists.GetByTitle("Supply GateWay");
ListItemCreationInformation itemCreateInfo = new ListItemCreationInformation();
Microsoft.SharePoint.Client.ListItem newItem = announcementsList.AddItem(itemCreateInfo);
newItem["Title"] = C_Name.Value;
newItem["Address"] = C_Address.Value;

A lot of code samples at


This is a good template with CRUD function in asp.net gridview by asp:TemplateField with control events(OnRowDeleting/OnRowEditing/OnRowUpdating etc.).

You could achieve insert function in footer template also, follow this official demo.

Hope this would help you.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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