Saturday 29 September 2012

THIS VIEW CANNOT BE DISPLAYED BECAUSE THE NUMBER OF LOOKUP AND WORKFLOW STATUS COLUMNS IT CONTAINS EXCEEDS THE THRESHOLD (8) ENFORCED BY THE ADMINISTRATOR


You may have this kind of error when you open a list.

this view cannot be displayed because the number of lookup and workflow status columns it contains exceeds the threshold (8) enforced by the administrator

The problem occurs because the number of managed metadata fields on a library exceeds the number permitted in the SharePoint environment configuration.  When this error occurs it can cause the SharePoint web services can refuse to return documents.

To solve this problem do the following


Setps:

1)Go to Central Administrator --> Manage Web Applications.

2)Select required Web Application --> Click General Settings and select Resource throttling



3)Go to the List View Lookup Threshold property and increase as required.




Wednesday 26 September 2012

Asp.net Sql Connection Insert command

Method1

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using sql = System.Data.SqlClient;

public partial class _Default : System.Web.UI.Page
{
   sql.SqlConnection sqlcon;
   sql.SqlCommand sqlcmd;
   string Emp_Name,Emp_ID,Salary;
   string connstr;

   protected void Page_Load(object sender, EventArgs e)
   {
        Emp_Name = "Raj";         Emp_ID = "3421";         Salary = "20000";

       connstr = "Data Source=SRV4;Initial Catalog=Employee;Integrated Security=True";

       sqlcon = new sql.SqlConnection(connstr);
       sqlcmd = sqlcon.CreateCommand();
       sqlcmd.CommandText = "INSERT INTO EmployeeDetails VALUES ('" + Emp_Name+ "','"

Emp_ID + "','" + Salary + "')";
       sqlcon.Open();
       sqlcmd.ExecuteNonQuery();
       sqlcon.Close();


   }
}



Method2(Prefered Method)


using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using sql = System.Data.SqlClient;

public partial class _Default : System.Web.UI.Page
{
   sql.SqlConnection sqlcon;
   sql.SqlCommand sqlcmd;
    string Emp_Name,Emp_ID,Salary;
   string connstr;

   protected void Page_Load(object sender, EventArgs e)
   {
        Emp_Name = "Raj";         Emp_ID = "3421";         Salary = "20000";

       connstr = "Data Source=SRV4;Initial Catalog=Employee;Integrated Security=True";

       sqlcon = new sql.SqlConnection(connstr);
       sqlcmd = sqlcon.CreateCommand();
       sqlcmd.CommandText = "INSERT INTO EmployeeDetails VALUES (@name,@id,@salary)";
       sqlcmd.Parameters.AddWithValue("@name", Emp_Name);
       sqlcmd.Parameters.AddWithValue("@id", Emp_ID);
       sqlcmd.Parameters.AddWithValue("@salary", Salary);

       sqlcon.Open();
       sqlcmd.ExecuteNonQuery();
       //inside for loop use below code
       sqlcmd.Parameters.Clear();
       sqlcon.Close();
   }

}

Friday 21 September 2012

Sharepoint 2010 web or subsite Backup Restore


BACKUP AND RESTORE OF A WEB OR SUBSITE IN SHAREPOINT 2010


Backup web:


        Open sharepoint power shell. and type the following  command on your power shell

Import-spweb <fullurl which u want to backup> -path <location>  

Restore web:


        Open sharepoint power shell. and type the following  command on your power shell

Export-spweb <fullurl where u want to restore> -path <location>

How to use Sharepoint2010 List Template



    You can create a list template and restore it in any places as a list.

CREATE A LIST TEMPLATE:


       Do it in following way.

(Open your site->)list->list settings->save list as a template

and save the template at any place you want.


RESTORE THE TEMPLATE TO LIST:


      Do it in following way

(open your site)->site actions->site settings->gallaris->list templates->(document->upload document)

     And after that

Site Actions->more Options->list->(there you can find your template name.And select that template name)

Tuesday 18 September 2012

Silverlight LineSeries Datapoint & Polyline Styling

Get Microsoft Silverlight
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;

namespace LineChart
{
    public partial class MainPage : UserControl
    {
        List<EmployeeChart> employeechart;
        public MainPage()
        {
            InitializeComponent();

           
            employeechart = new List<EmployeeChart>();

            employeechart.Add(new EmployeeChart()
            {
                employeename = "Emp1",
                sickleave = 7,
                casualleave=9
            });
            employeechart.Add(new EmployeeChart()
            {
                employeename = "Emp2",
                sickleave = 5,
                casualleave=3
            });
            
    employeechart.Add(new EmployeeChart()
            {
                employeename = "Emp3",
                sickleave = 6,
                 casualleave=8
            });
             employeechart.Add(new EmployeeChart()
             {
                 employeename = "Emp4",
                 sickleave = 8,
                  casualleave=7
             });
             employeechart.Add(new EmployeeChart()
             {
                 employeename = "Emp5",
                 sickleave = 9,
                  casualleave=7
             });
   
            chart1.DataContext = employeechart;
        }

        public class EmployeeChart
        {
            public string employeename { get; set; }
            public int sickleave { get; set; }
            public int casualleave { get; set; }
        }

      
    }
}


          
        
  
        
        
    
        
        
            
            
            
            
        
        
         
         
                                       
           
           
                 
     
  
   
         
          
                                       
             
             
             
     
  
        
  
  
    


Friday 14 September 2012

Silverlight Datagrid Get Data on Selcetion

Get Microsoft Silverlight

The cs code is as follows
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;

namespace grid
{
    public partial class MainPage : UserControl
    {
        public MainPage()
        {
            InitializeComponent();

            List&ltdata&gt employeedetails = new List&ltdata&gt();

            employeedetails.Add(new data() 
                 { Name="Latha",
                   ID="3456",
                   Salary="12000" 
                  });
            employeedetails.Add(new data() 
                  { Name = "Geetha", 
                    ID = "3457", 
                    Salary = "13000" 
                  });
            employeedetails.Add(new data() 
                  { Name = "Mohan", 
                    ID = "3458", 
                    Salary = "14000" 
                  });
            employeedetails.Add(new data() 
                  { Name = "Ram", 
                    ID = "3459", 
                    Salary = "15000" 
                  });
            employeedetails.Add(new data() 
                  { Name = "Sundar", 
                    ID = "34570",
                    Salary="16000" });

            dataGrid1.ItemsSource = employeedetails;
        }

        public class data
        {
            public string Name { get; set; }
            public string ID { get; set; }
            public string Salary { get; set; }
        }

        private void dataGrid1_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            DataGrid datagrid = sender as DataGrid;
            DataGridColumn column = datagrid.Columns[1];

            FrameworkElement fe = column.GetCellContent(dataGrid1.SelectedItem);
            FrameworkElement result = GetParent(fe, typeof(DataGridCell));

            if (result != null)
            {
                DataGridCell cell = (DataGridCell)result;
                TextBlock tx = cell.Content as TextBlock;
                label1.Content = tx.Text;
            }
        }

        private FrameworkElement GetParent(FrameworkElement child, Type targetType)
        {
            object parent = child.Parent;
            if (parent != null)
            {
                if (parent.GetType() == targetType)
                {
                    return (FrameworkElement)parent;
                }
                else
                {
                    return GetParent((FrameworkElement)parent, targetType);
                }
            }
            return null;
        } 
    }
}


The XAML code is as follows



    
        
        
        
    


Silverlight Bubble Chart Datapoint Styling

Get Microsoft Silverlight
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;

namespace BubbleChart
{
    public partial class MainPage : UserControl
    {
        List<EmployeeChart> employeechart;
        public MainPage()
        {
            InitializeComponent();

           
            employeechart = new List<EmployeeChart>();

            employeechart.Add(new EmployeeChart()
            {
                employeename = "Emp1",
                sickleave = 7,
                casualleave=9
            });
            employeechart.Add(new EmployeeChart()
            {
                employeename = "Emp2",
                sickleave = 5,
                casualleave=3
            });
            
    employeechart.Add(new EmployeeChart()
            {
                employeename = "Emp3",
                sickleave = 6,
                 casualleave=8
            });
             employeechart.Add(new EmployeeChart()
             {
                 employeename = "Emp4",
                 sickleave = 8,
                  casualleave=7
             });
             employeechart.Add(new EmployeeChart()
             {
                 employeename = "Emp5",
                 sickleave = 9,
                  casualleave=7
             });
   
            chart1.DataContext = employeechart;
        }

        public class EmployeeChart
        {
            public string employeename { get; set; }
            public int sickleave { get; set; }
            public int casualleave { get; set; }
        }
    }
}