Prasad Bolla's SharePoint Blog

Click Here to go through the Interesting posts within my Blog.

Click Here to go through the new posts in my blog.

Monday, April 01, 2013

Windows7 And Windows Server 2008 R2 Not getting Booted in Normal Mode.

This will happen after the windows update is performed. To resolve this please follow the below steps.
  1. Open your windows 7/Windows Server 2008 R2 in Safe Mode.
  2. Now click on Control Panel.
  3. In Control Panel click on Programs.
  4. Now you will find Programs & Features.
  5. Now you will find all the programs installed in your machine.
  6. Filter the softwares based on Installed on date.
  7. Now you see the software with Today date.
  8. Select respective software and uninstall it.
Note:-
I think the name of the s/w would be Intel HD Accelerated Graphics Driver.

Binding items From SharePoint List to Combo Box using SilverLight Client Object Model

Note:-
If you want to bind both Value and Text for Combo Box Please select SilverLight Version 4 in order to make selected value property of Combo Box to work. In SilverLight Version3 you will not find the property of selected value for Combo Box.
Ascx
<UserControl x:Class="SilverlightApplication1.MainPage"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    mc:Ignorable="d"
    d:DesignHeight="300" d:DesignWidth="400">

    <Grid x:Name="LayoutRoot" Background="White">
        <ComboBox Height="37" HorizontalAlignment="Left" Margin="10,10,0,0" Name="ddlBindData" VerticalAlignment="Top" Width="247" DisplayMemberPath="Title" SelectedValuePath="ID" SelectedValue="{Binding Path=ID, Mode=TwoWay}"  />
    </Grid>
</UserControl>


Ascx.Cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using Microsoft.SharePoint.Client;

namespace SilverlightApplication1
{
    public partial class MainPage : UserControl
    {
        public MainPage()
        {
            InitializeComponent();
            ddlBindData.SelectionChanged += new SelectionChangedEventHandler(ddlBindData_SelectionChanged);
            getData();
        }

        void ddlBindData_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            MessageBox.Show(ddlBindData.SelectedValue.ToString());
        }

        public class NewThoughts
        {
            public int ID{get;set;}
            public string Title{get;set;}
        }
        private IEnumerable<ListItem> myColl = null;
        public void getData()
        {
            try
            {
                ClientContext context = ClientContext.Current;
                Web objWeb = context.Web;
                List lstNewThoughts = objWeb.Lists.GetByTitle("New Ideas");
                CamlQuery strQuery = new CamlQuery();
                strQuery.ViewXml = "<View><Query><OrderBy><FieldRef Name='Title' /></OrderBy></Query></View>";
                var items = lstNewThoughts.GetItems(strQuery);
                context.Load(lstNewThoughts);
                myColl = context.LoadQuery(items.Include(l => l["Title"], l=>l.Id));
                context.ExecuteQueryAsync(OnListItemsLoadSucceeded, OnFailure);
            }
            catch (Exception Ex)
            {
                MessageBox.Show(Ex.ToString());
            }
        }
        private delegate void UpdateUIMethod();
        private void OnListItemsLoadSucceeded(object sender, ClientRequestSucceededEventArgs e)
        {
            UpdateUIMethod updateUI = LoadListItems;
            this.Dispatcher.BeginInvoke(updateUI);
        }
        private void OnFailure(object sender, ClientRequestFailedEventArgs e)
        {
            MessageBox.Show("Request Failed: " + e.Message + ", Stack Trace:" + e.StackTrace);
        }
        private void LoadListItems()
        {
            ddlBindData.Visibility = System.Windows.Visibility.Visible;
            List<NewThoughts> lItems = new List<NewThoughts>();
            foreach (ListItem item in myColl.ToList())
                lItems.Add(new NewThoughts
                {
                    Title = item["Title"].ToString(),
                    ID=item.Id,
                });
            ddlBindData.ItemsSource = lItems;
        }
    }

}


Friday, March 29, 2013

Delete a SharePoint ListItem using silverLight Client Object Model



Write this in button click event.
private string siteUrl = "http://Spserver:100/";

try
            {
                ClientContext clientContext = new ClientContext(siteUrl);
                List oList = clientContext.Web.Lists.GetByTitle("New Ideas");
                ListItem oListItem = oList.GetItemById(4);
                oListItem.DeleteObject();
                clientContext.ExecuteQueryAsync(onQuerySucceeded, onQueryFailed);
            }
            catch (Exception Ex)
            {
                lblErrorMessage.Content = Ex.ToString();
            }

private void onQuerySucceeded(object sender, ClientRequestSucceededEventArgs args)
        {
            UpdateUIMethod updateUI = DisplayInfo;
            this.Dispatcher.BeginInvoke(updateUI);
        }

        private void DisplayInfo()
        {
            //MyOutput.Text = "New item created in " + oList.Title;
            lblErrorMessage.Content = "Item Deleted";
        }

        private delegate void UpdateUIMethod();

        private void onQueryFailed(object sender, ClientRequestFailedEventArgs args)
        {
            MessageBox.Show("Request failed. " + args.Message + "\n" + args.StackTrace);
        }

Update a SharePoint ListItem using silverLight Client Object Model



Write this in button click event.
private string siteUrl = "http://SpServer:100/";

try
            {
                ClientContext clientContext = new ClientContext(siteUrl);
                List oList = clientContext.Web.Lists.GetByTitle("New Ideas");
                ListItem oListItem = oList.GetItemById(3);

                oListItem["Title"] = txtNewIdea.Text;

                oListItem.Update();
                clientContext.ExecuteQueryAsync(onQuerySucceeded, onQueryFailed);
            }
            catch (Exception Ex)
            {
                lblErrorMessage.Content = Ex.ToString();
            }
private void onQuerySucceeded(object sender, ClientRequestSucceededEventArgs args)
        {
            UpdateUIMethod updateUI = DisplayInfo;
            this.Dispatcher.BeginInvoke(updateUI);
        }

        private void DisplayInfo()
        {
            //MyOutput.Text = "New item created in " + oList.Title;
            lblErrorMessage.Content = "Item Updated";
        }

        private delegate void UpdateUIMethod();

        private void onQueryFailed(object sender, ClientRequestFailedEventArgs args)
        {
            MessageBox.Show("Request failed. " + args.Message + "\n" + args.StackTrace);
        }