This question is locked. New answers and comments are not allowed.
Hey there!
I m a little bit stuck here, I am working on a Silverlight Telerik gridview that is later to be uploaded into a SharePoint 2010 web part.
Ive got 2 questions that has been bothering me that i would appreciate if anyone could answer.
Im working on a gridview as mentioned and I do like to add a edit column functionality, fine that should be fairly easy ( I thought)
I thought of using client object model (cus not REST nor any webservice is working within Silverlight and SharePoint along with external lists?)
So I created a class that will represent the SharePoint list, with all the columns represented. Then I use the ClientContext retrieve the SharePoint list from site, All good.
Now to the actual problem
When it comes to editing since I need to push back the data to the SharePoint list, I need to alter the list somehow.
So I used the function private void EditingRowsGrid_RowEditEnded(object sender, GridViewRowEditEndedEventArgs e)
Question: So now I need to get the the current row and get the ID from the unique column. How could that be accomplished?
Ive tried with getting the data from the sharepoint list and pushing it in to my SalesItem class, that holds all the rows for the gridview.
and then use
Sales test = e.OldValues as Sales; to get access to the current row that was edited and use test.CUSTOMER_CODE to get the unique column
Heres my code:
private void EditingRowsGrid_RowEditEnded(object sender, GridViewRowEditEndedEventArgs e)
{
Sales test = e.OldValues as Sales;
ClientContext context = new ClientContext(SPSite);
List list = context.Web.Lists.GetByTitle(SPList);
CamlQuery query = new CamlQuery();
query.ViewXml = "<View><Query><Where><Contains><FieldRef Name='CUSTOMER_CODE'/><Value Type='Integer'>" + test.CUSTOMER_CODE + "</Value></Contains></Where></Query></View>";
ListItemCollection items = list.GetItems(query);
context.Load(items);
context.ExecuteQuery();
// Here goes the code to set the data that was changed/
// then context.ExecuteAsync to push back the changed to the SharePoint list.
}
I think this should work, appearently it doesnt,that doesn't require me to create a class that holds the row item.
Question: Is there a better way to edit and update the SharePoint List?
Please bear with the wall of text, I just wanted you to understand the idea.
Thanks in advance fore any help!
I m a little bit stuck here, I am working on a Silverlight Telerik gridview that is later to be uploaded into a SharePoint 2010 web part.
Ive got 2 questions that has been bothering me that i would appreciate if anyone could answer.
Im working on a gridview as mentioned and I do like to add a edit column functionality, fine that should be fairly easy ( I thought)
I thought of using client object model (cus not REST nor any webservice is working within Silverlight and SharePoint along with external lists?)
So I created a class that will represent the SharePoint list, with all the columns represented. Then I use the ClientContext retrieve the SharePoint list from site, All good.
Now to the actual problem
When it comes to editing since I need to push back the data to the SharePoint list, I need to alter the list somehow.
So I used the function private void EditingRowsGrid_RowEditEnded(object sender, GridViewRowEditEndedEventArgs e)
Question: So now I need to get the the current row and get the ID from the unique column. How could that be accomplished?
Ive tried with getting the data from the sharepoint list and pushing it in to my SalesItem class, that holds all the rows for the gridview.
and then use
Sales test = e.OldValues as Sales; to get access to the current row that was edited and use test.CUSTOMER_CODE to get the unique column
Heres my code:
private void EditingRowsGrid_RowEditEnded(object sender, GridViewRowEditEndedEventArgs e)
{
Sales test = e.OldValues as Sales;
ClientContext context = new ClientContext(SPSite);
List list = context.Web.Lists.GetByTitle(SPList);
CamlQuery query = new CamlQuery();
query.ViewXml = "<View><Query><Where><Contains><FieldRef Name='CUSTOMER_CODE'/><Value Type='Integer'>" + test.CUSTOMER_CODE + "</Value></Contains></Where></Query></View>";
ListItemCollection items = list.GetItems(query);
context.Load(items);
context.ExecuteQuery();
// Here goes the code to set the data that was changed/
// then context.ExecuteAsync to push back the changed to the SharePoint list.
}
I think this should work, appearently it doesnt,that doesn't require me to create a class that holds the row item.
Question: Is there a better way to edit and update the SharePoint List?
Please bear with the wall of text, I just wanted you to understand the idea.
Thanks in advance fore any help!