This is a migrated thread and some comments may be shown as answers.

Edit/Update/Delete using Radgrid for Sharepoint List

5 Answers 223 Views
Grid
This is a migrated thread and some comments may be shown as answers.
smith spd
Top achievements
Rank 1
smith spd asked on 15 Nov 2010, 01:13 AM
Hello Telerik team,

I have a requirement where I need to Edit/Update/Delete the items on a radgrid which are populated from a sharepoint list meaning my datasource is sharepoint datatable.I am using Pop up edit form on edit like shown in this http://demos.telerik.com/aspnet-ajax/grid/examples/dataediting/popupeditform/defaultcs.aspx and when i click on "edit" I am able to show my present list item values on pop up edit form for that particular item.How do i write the events on "Update" and "Cancel" buttons inside the pop up edit form and how do i grab that particular item and update that item only.

I have one more issue.As shown in the blog mentioned above, I have a add new record.But when i click on that I am not able to show up the new edit pop up form and what kind of event can be written on that edit form to insert the record into the sharepoint list.

I have one more, I have used a rad window on delete which comes by using "Confirmtype"="Radwindow" on the column.How to write the events on that dialog box to delete or cancel the selected item.

Please provide me a sample with the sharepoint list because I saw many samples for sql datasource and none for a sharepoint list.
I greatly appreciate your response.

Thanks
Smith

5 Answers, 1 is accepted

Sort by
0
Tsvetoslav
Telerik team
answered on 18 Nov 2010, 02:49 PM
Hi,

Have you looked at out Telerik SPRadGrid Web Part (sharepoint.telerik.com) - it supports the functionality you need out of the box.

Regards,
Tsvetoslav
the Telerik team
Browse the vast support resources we have to jumpstart your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.
0
Vishwajit
Top achievements
Rank 1
answered on 11 Dec 2010, 08:13 PM
Hi Telerik Team,
I am trying to delete Sharepoint selected list on RadGrid conrol. I have added a checkbox column to select multiple rows and a checkbox with each row to select particuler row and i want to delete checkbox selected row on button click event.The button is out side of RadGrid.Can you help me how can i do this?
0
Tsvetoslav
Telerik team
answered on 14 Dec 2010, 02:31 PM
Hi Vishwajit,

1. Attach a click handler to the button.

2. In the click handler traverse all the items in the grid (RadGrid1.Items).

3. For each item, find the checkbox and see if it is checked.

4. If checked, get the datakey value ( ((GridDataItem)item).GetDataKeyValue("FieldName") ).

5. Delete the item from the underlying datasource.

6. Upon exiting the loop, rebind the grid.

Best wishes,
Tsvetoslav
the Telerik team
Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.
0
Vishwajit
Top achievements
Rank 1
answered on 14 Dec 2010, 04:28 PM
Hi Telerik Team,
                         Very first time i am using Telerik control so give me detail idea abouth this i am trying this:
 I displayed the sharepoint list on radgrid also added one checkbox column just before ID column and there is checkbox
with each row to select particuler row and there is a Button control out side of RadGrid. Now i want to write code on that button event to delete
selected row.I have written this code: 
protected void btnDelete_Click(object sender, EventArgs e)
{
foreach (GridItem item in RadGrid1.Items) {
if (item.Selected)
{
string deleteItemID = RadGrid1.SelectedItems[0].Cells[3].Text;
// for (int k = 0; k <= RadGrid1.SelectedItems.Count; k++)
{
int k = Convert.ToInt32(deleteItemID);
string sharePointRoot1 = "http://sas:8585/Lists/Users";
SPSite spSite1 = new SPSite(sharePointRoot1);
SPWeb openWeb1 = spSite1.OpenWeb();
SPList spList1 = openWeb1.Lists["Display"];
SPListItem listItem = spList1.GetItemById(k);
openWeb1.AllowUnsafeUpdates =
true;
listItem.Delete();
DecendingRadGrid();
ShowGrid();
}}}
But when i clcik the button only first selected row is deleting.After binding the grid all selected items get unselected.
Can you help me to give full code?
Thanks,

 

0
Tsvetoslav
Telerik team
answered on 17 Dec 2010, 12:39 PM
Hi Vishwajit,

RadGrid does not persist its selected rows state automatically. You need to code around this. Here are some guidelines:
http://www.telerik.com/help/aspnet/grid/grdpersistselectedrowsonsorting.html

All the best,
Tsvetoslav
the Telerik team
Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.
Tags
Grid
Asked by
smith spd
Top achievements
Rank 1
Answers by
Tsvetoslav
Telerik team
Vishwajit
Top achievements
Rank 1
Share this question
or