Monday, July 04, 2011

The file '/_controltemplates/Usercontrol.ascx' does not exist

You will get this error when you implement CAS(Code Access Security) in SharePoint.To resolve this issue just add/update trust level from "Custom" to "Full".Thats it.
 trust level="Full" originUrl="" />
<

Tuesday, May 10, 2011

The server sent a response which SharePoint Designer could not parse

This error occours, when you open the default.master page using SharePoint Designer 2007, then the problem would be in your web.config file
ie.

The key problem  is  <remove verb="*" path="*.asmx" />. So remove this line and put it next to <remove verb="GET,HEAD,POST" path="*" /> this line.

So, final code should be looks like below one..
All the Best!!!

Friday, April 29, 2011

Sharepoint : Remove 'Pages' text in breadCrumb

This artical help to remove default 'Pages' text in breadcrumb section.

1.Add below javascript code to your sharepoint master page
function breadCrumbs()
 {
  var breadCrumbs = document.getElementById('ctl00_PlaceHolderTitleBreadcrumb_siteMapPathbreadcrumb');
 //alert(breadCrumbs.childNodes.length);
 if (breadCrumbs != null)
 {
  if (breadCrumbs.childNodes.length >= 3)
  {
   var pages = breadCrumbs.childNodes.length-4;
  
   var gt = breadCrumbs.childNodes.length-3;
  
   if (breadCrumbs.childNodes[pages].innerHTML.indexOf('Pages') > 0)
   {
    if (breadCrumbs.childNodes[breadCrumbs.childNodes.length-2].innerText == 'default.aspx')
    {
     breadCrumbs.childNodes[breadCrumbs.childNodes.length-2].style.display= "none";
     breadCrumbs.childNodes[breadCrumbs.childNodes.length-3].style.display= "none";
     breadCrumbs.childNodes[breadCrumbs.childNodes.length-4].style.display= "none";
     breadCrumbs.childNodes[breadCrumbs.childNodes.length-5].style.display= "none";
    }
    else
    {
     breadCrumbs.childNodes[pages].style.display= "none";
     breadCrumbs.childNodes[gt].style.display= "none";
     var str=breadCrumbs.childNodes[pages+2].innerText;
     str=str.replace(".aspx","");
     breadCrumbs.childNodes[breadCrumbs.childNodes.length-2].innerText=str;
    }     
   }
  }
 }
 }
2.Add this function in body of master page like below
  <body class="body" onload="javascript:breadCrumbs();">
3.Save and run

Tuesday, March 15, 2011

CSV File BULK Upload using ASP.NET & SQL

if (CSVFileUpd.HasFile)
{
       string filePath = CSVFileUpd.PostedFile.FileName;
       string filenameStor = CSVFileUpd.FileName;
       string filenameType = System.IO.Path.GetExtension(CSVFileUpd.PostedFile.FileName);
       if (filenameType.ToString().Trim().ToLower() == ".csv")
       {
                System.IO.Stream str = default(System.IO.Stream);
                str = CSVFileUpd.PostedFile.InputStream;
                System.IO.StreamReader sr = new System.IO.StreamReader(str);
                string[] tokens = null;
                 string line = null;
                 // string token = null;
                 //Response.Write("<table>");
                 System.Data.DataTable dt = new System.Data.DataTable("CSVFileData");
                // Define 3 columns
                 System.Data.DataColumn dc;
                 dc = new System.Data.DataColumn("Id");
                dt.Columns.Add(dc);
                dc = new System.Data.DataColumn("Name");
                dt.Columns.Add(dc);
                dc = new System.Data.DataColumn("Prefix");
                dt.Columns.Add(dc);
                do
               {
                  line = sr.ReadLine();
                  if (line == null)
                   break; // TODO: might not be correct. Was : Exit Do
                   if (line == "")
                   {
                      lblMessage.Text = "File content is empty!";
                        break;
                   }
                  //Response.Write("<tr>");
                 tokens = line.Split(',');
                 if (line.Split(',').Length != 3)
                {
                      lblMessage.Text = "Invalid file! File should have 3 columns.";
                      break;
                 }
                if (tokens[0].Length > 0 && tokens[1].Length > 0)
               {
                     dt.Rows.Add(tokens[0], tokens[1], tokens[2]);
                }
              } while (!(line == null));
             // Response.Write("</table>");
            sr.Close();
            lblMessage.Text = CSVFileUpload(dt);
      }
      else
     {
         lblMessage.Text = "Please select .CSV/.csv  file!";
    }

protected string CSVFileUpload(System.Data.DataTable dtCSV)
{
using (System.Data.SqlClient.SqlBulkCopy bulk = new System.Data.SqlClient.SqlBulkCopy("Data Source=LOCALHOST\MSSQLSERVER;Initial Catalog=Reporting_Testing;Integrated Security=True"))
{
try
{
bulk.DestinationTableName = "MyDetails";
bulk.WriteToServer(dtCSV)
return "CSV File uploaded successfully!";
}
catch (Exception ex)
{
return ex.Message.ToString();
}
}
}

Tuesday, March 08, 2011

Error: “Sys” is Undefined Error

This is an javascript error will display in the browser because of some references missing in web.config file of your application and specially when you host your application to the server.
To resolve this please follow the below steps
1. Open the web.config file
2.Copy the below code to inside of


Http handlers are the .NET Components that implement the System.Web.IHttpHandler.
They are similar to ISAPI extensions,but one difference is the Http handles can be called directly by using their file name in the URL.
3.Copy the below code inside of


HTTP modules are .NET components that implements the System.Web.IHttpModule interface.
They are plug into the ASP.NET request processing pipeline by registering themselves for certain events

Tuesday, February 15, 2011

The workflow template has specified no FormURN for this page in Sharepoint


1.Created a sequential workflow project "SequentialWorkflowFeatureEmail" using WSPBuilder Template
2.Updated the Element file as follows.

Actual Element.xml file: (Removed lines with yellow background)

We have updated the element.xml file as below

Updated Element.xml File(Added line with yellow background)

3.Now activate the workflow


Additional exception information Invalid object name master.dbo.spt.values

If you get this error while Sharepoint products and configuration wizard Configuration Please follow the below steps to resolve this issue.

1. Go to MSSQL\Install folder inside Microsoft SQL Server in your Database PC/Server
2. Find the u_tables.sql file, open with MS SQL Management Studio
3. Run the scripts
4. Then re run the Sharepoint products and configuration wizard Configuration