try
{
SPWeb currentWeb = SPContext.Current.Web;
ClientContext clientContext = new ClientContext(currentWeb.Url);
Web web = clientContext.Web;
List list = web.Lists.GetByTitle("Login");
CamlQuery query = new CamlQuery();
query.ViewXml = @"<Query><Where><Eq><FieldRef Name='ID' /><Value
Type='Counter'>" + ddlID.SelectedItem.Value + "</Value></Eq></Where></
Query>";
Microsoft.SharePoint.Client.ListItemCollection listItems =
list.GetItems(query);
clientContext.Load(listItems);
clientContext.ExecuteQuery();
foreach (Microsoft.SharePoint.Client.ListItem item in listItems)
{
if (ddlID.SelectedItem.Value == item["ID"].ToString())
{
item["Title"] = txtUserName.Text;
item["Password"] = txtPassWord.Text;
item.Update();
strError += "Updation Successful";
break;
{
strError += ex.ToString();
}
{
SPWeb currentWeb = SPContext.Current.Web;
ClientContext clientContext = new ClientContext(currentWeb.Url);
Web web = clientContext.Web;
List list = web.Lists.GetByTitle("Login");
CamlQuery query = new CamlQuery();
query.ViewXml = @"<Query><Where><Eq><FieldRef Name='ID' /><Value
Type='Counter'>" + ddlID.SelectedItem.Value + "</Value></Eq></Where></
Query>";
Microsoft.SharePoint.Client.ListItemCollection listItems =
list.GetItems(query);
clientContext.Load(listItems);
clientContext.ExecuteQuery();
foreach (Microsoft.SharePoint.Client.ListItem item in listItems)
{
if (ddlID.SelectedItem.Value == item["ID"].ToString())
{
item["Title"] = txtUserName.Text;
item["Password"] = txtPassWord.Text;
item.Update();
strError += "Updation Successful";
break;
}
}
clientContext.ExecuteQuery(); }
}
catch (Exception ex) {
strError += ex.ToString();
}
No comments:
Post a Comment