.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
david stephan
Gaurav Pal
Post New Web Links

Javascript error when creating XsltListViewWebPart programatically

Posted By:      Posted Date: September 29, 2010    Points: 0   Category :SharePoint

Hi everyone,

I am receiving a Javascript error when attempting to use the context menu on any XsltListViewWebPart that is added to a page programatically.

The JS error is:


Message: 'listTemplate' is null or not an object
Line: 2
Char: 102472
Code: 0
URI: http://teamsite.domain.com/_layouts/1033/core.js?rev=c3ROI4x%2BKHVTMbn4JuFndQ%3D%3D

The code I am using to add the webpart to the page is:


private static void AddListViewWebPart(string siteCollUrl, string siteRelativeUrl, String pageUrl, string listName, string webPartTitle, String zoneId, int zoneIndex, string viewName, PartChromeType chromeType, string toolbarType)
  using (SPSite site = new SPSite(siteCollUrl))
   using (SPWeb web = site.AllWebs[siteRelativeUrl])
    SPLimitedWebPartManager lwpm = web.GetLimitedWebPartManager(pageUrl, PersonalizationScope.Shared);
    SPList list = web.Lists[listName];
    XsltListViewWebPart lvwp = new XsltListViewWebPart();
    lvwp.ListId = list.ID;
    lvwp.ViewGuid = list.Views[viewName].ID.ToString("B").ToUpper(CultureInfo.InvariantCulture);
    lvwp.AllowClose = false;
    lvwp.AllowConnect = false;
    lvwp.AllowEdit = false;
    lvwp.AllowHide = false;
    lvwp.AllowMinimize =

View Complete Post

More Related Resource Links

Creating Folder Programatically - Error


Dearn all,

I have installed SharePoint Server 2010 and I am developing a Windows application in Visual Studio 2008 C#.

What I want is to create a folder in the SharePoint site:

I am getting the following error while debuggin:

[System.UnauthorizedAccessException] = {"<nativehr>0x80070005</nativehr><nativestack></nativestack>"}

Please Find below part of my Code:




using (SPSite oSPsite = new SPSite(strTargetWebS

javascript error


this line is giving error in javascript. Please correct it...

  $('#UnlockDetailsPanel').load('/confidentialdetails/UnlockDetailsUpdate.aspx #UnlockDetailsResult', { action: 'decline', request: <%= Request["request"] %> } );

error is _s.my.confidentialdetails is undefined



Object or Property is not supported in IE8 - javascript error



I am using following code line in my web app through external javascript file.






both these methods are working fine in IE6 but failing in IE8 with a error: "Object or Property is not supported".


any solution would be appreciated!



BDC + Document Information Panel Javascript Error


I hope someone here can shed some light on this one...


We have a document library configured with a few content types and document information panels for those items. Also on this list we have a BDC column setup to pull client names from MS CRM. This works fine on the list itself, however, in Word 2007 - the picker does not show up in the DIP, so we cannot easily select clients without knowing the name (first issue).

Secondly, if we enter in a client name, or partial, we recieve the following error:

"There was an error in the validation code" - with the following details:
Document Information Panel cannot complete this action, because of an error
in the form's code.
The following error occurred:

Object required
FileTongue Tiedcript.js

Any help is appreciated!

Javascript error on Rich Text Editor of CEWP

Hi all,

I have a problem that is really bugging and I wasn't able to find any workaround all day. I'll try to give as many details as possible:

I'm maintaining several site collections on a single server and this problem occurs only on one of the site collections. However it occurs on all subsites of this collection, it occurs on old pages and newly created pages, even on pages containing only one empty CEWP.

When I'm pressing the button for Rich Text Editor of CEWP I get the following error:

Message: Invalid argument.
Line: 5740
Char: 2
Code: 0
URI: http://www.dyrlaegeankenaevn.dk/_layouts/1030/HtmlEditor.js

I've tracked down the error with IE developer tools and I found that the error pops up in HtmlEditor.js at

function RTE2_GenerateLaunchArguments(parameterArray, webUrl, containerID)
    ............some code goes here......................
    ............some code goes here......................

I followed containerID down the stack and it comes from:

modalpopup and javascript error object required

Hi!   I Have this error when click on a button to open a popup box in my page: "object required"   Here is my code:   <%@ Page Language="VB" MasterPageFile="~/artm.master" AutoEventWireup="false" CodeFile="artm_principal.aspx.vb" Inherits="artm_principal" title="Principal" Debug="true" MaintainScrollPositionOnPostback="true"%><%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="AJT" %> <asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">                                      <AJT:ToolkitScriptManager ID="ToolkitScriptManager1" runat="server"></AJT:ToolkitScriptManager>                                        <AJT:ModalPopupExtender ID="ModalPopupExtender1" runat="server"         &

Error when creating a net.tcp endpoint in wcf

I am trying to create a simple wcf service that has a net.tcp endpoint.  My OS is Vista and I am hosting the service in IIS 7.  I have set my default website binding for net.tcp to "9200:*" and added net.Tcp to my Enabled Protocols in my website hosting the service and the default website.  Here is my Config Values:   <system.serviceModel>     <services>       <service name="FirstWcfService.Service" behaviorConfiguration="ServiceBehavior">         <!-- Service Endpoints -->         <endpoint address="" binding="netTcpBinding" contract="FirstWcfService.IService"             bindingConfiguration="tcpbinding"/>         <endpoint address="mextcp" binding="mexTcpBinding" contract="IMetadataExchange"/>         <endpoint address="" binding="wsHttpBinding" contract="FirstWcfService.IService"             />         <endpoint address="mexhttp" binding="mexHttpBinding" contract="IMetadataExchange"/>       </service>     </services>     <behaviors>       <serviceBehaviors>         <behavior name="ServiceBehavior">           <!-- To receive exception details in faults for debugging purposes,                set the value below to true.  Set to false befor

Error creating Web Apps

I am getting the following error when I try and create a Web APP. Error An error occurred while getting information about the user FarmAdmin at server ServeName.com: The network path was not found  Troubleshoot issues with Microsoft SharePoint Foundation. Correlation ID: 6ea31cf3-22bd-4e02-b87b-c1b8a1990ab1 Date and Time: 8/30/2010 2:24:55 PM I have set the logging to verbose The Event logs show nothing. The Sharepoint logs show Provisioning of the web application, null, has encountered the following error: System.InvalidOperationException: An error occurred while getting information about the user FarmAdmin at server ServeName.com: The network path was not found at Microsoft.SharePoint.Win32.SPNetApi32.NetUserGetInfo1(String server, String name)     at Microsoft.SharePoint.Administration.SPManagedAccount.GetUserAccountControl(String username)     at Microsoft.SharePoint.Administration.SPManagedAccount.Update()     at Microsoft.SharePoint.Administration.SPProcessIdentity.Update()     at Microsoft.SharePoint.Administration.SPApplicationPool.Update()     at Microsoft.SharePoint.Administration.SPWebApplication.CreateDefaultInstance(SPWebService service, Guid id, String applicationPoolId, SPProcessAccount processA... 6ea31cf3-22bd-4e02-b87b-c1b8a1990ab1 ...ccount, Str

Javascript Error in Internet Explorer but works fine in Firefox

Hi All,i was working on one of the project as it is working fine in Firefox but it is giving the javascript exception in internet explorer.Errror:  Error says  "s" is undefined in the s.currencyCode="USD" line but "s" is defined in the external javascript file  s_code.jsCan anyone suggest the solution for this issue:Please find my code where the error is displayed <script type="text/javascript" language="JavaScript" >var s_account="mnsdev"</script><script type="text/javascript" language="JavaScript" src="http://media.world.com/ads/usen/rpt/Omniture/s_code.js"></script><script type="text/javascript" language="JavaScript" >s.currencyCode="USD"s.charSet="ISO-8859-1"s.SEMct = s.getQueryParam('s_kwcid');s.SEMct = s.getValOnce(s.SEMct,'SEM_ct',0);s.clickPast(s.SEMct,'event9','event10');s.SEMvar=s.getQueryParam('s_kwcid');s.SEMdate=new Date;s.SEMdate.setTime(s.SEMdate.getTime()+60*86400000)if(s.SEMvar){s.c_w('SEM_ck','1',s.SEMdate)}s.SEMchk=s.c_r('SEM_ck');if(s.SEMchk&&s.events)s.SEMok='ok';if(s.SEMvar||s.SEMok) s.t()

Error when creating PK to a column which has dupliacte columns..

The CREATE UNIQUE INDEX statement terminated because a duplicate key was found for the object name 'table name' and the index name 'PK__column__118068EB'. The duplicate key value is (D1).

Error creating Read Item or Read List operation in Sharepoint Designer 2010

In terms of high-level requirements, I need to pull in lists from a couple of different web apps.  To do this, I’m using SPD 2010 to create an External Content Type for the list of interest.  I’m able to create a SOAP Service or WCF Service connection just fine.  However, when I try to create the external content type and create a Read Item Operation on one of the GetList or any other Get* (or other Update methods for that matter) methods, I get the following error:"The method that your operation is based on has parameters with complex types that do not have default parameterless constructor.  This kind of data source methods cannot be used in Business Data Catalog."I tried defining an operation on the “AddAttachment” method, and that worked just fine.  I also tried providing default values to the listName and viewName parameters when creating the SOAP Service connection, but still get the error.  Same issue with a WCF Service connection as well. Does anyone know if this is a 2010 issue, or am I approaching this requirement incorrectly?  What are other approaches for connecting to lists that reside in a different web app than yours? 

Javascript "Undefined is null or not an object" error in IE :S

I read around and tried everything to figure out the reason of the issue i'm getting, but i give up, the error i'm getting is only on IE and it's the "Undefined is null or not an object" error.This is it:Line: 29Char: 13Error: 'undefined' is null or not an objectCode: 0This is the script:<script type="text/javascript">    function checkV1() {        if (document.getElementById('CB1').checked)            ValidatorEnable(document.getElementById('CheckBoxListValidator1'), true);        else            ValidatorEnable(document.getElementById('CheckBoxListValidator1'), false);    }    function checkV2() {        if (document.getElementById('CB2').checked)            ValidatorEnable(document.getElementById('CheckBoxListValidator2'), true);        else            ValidatorEnable(document.getElementById('CheckBoxListValidator2'), false);    }THIS IS LINE 29---->    fun

Error Creating Site Collection

Hello, I have created a basic claims-based web app in SharePoint 2010. When I try to create a Site Collection, after filling out all the details, I get the following error:   Error  Cannot complete this action. Please try again.  Troubleshoot issues with Microsoft SharePoint Foundation.  Correlation ID: 349b9ae9-7bda-41eb-921a-87974afb289c    I have tried ever which way to try and get it to work, but am still stuck. Any ideas as to why I can't create a Site Collection? Thanks!

Creating messagebox in asp.net / javascript in .Net 2.0

Hi All, Could you please take time to answer me these questions? 1> Is there any type of message dialog that can be shown from pure asp.net without using javascript? 2> If answer to #1 is "no" then, I want to show a messagebox with yes/no options instead of OK/Cancel. ( Confirm shows Ok/Cancel in javascript) 3> On clicking Yes/No I want to execute server side function based on logic. How I can do that? Regards, Sushant  

Error when creating site collection through programmatically?

hi all, When i am creating SharePoint Site collection through programmatically i am getting an error message. i am using below code...   using (SPSite site = new SPSite("http://servername:7853/")) {   using (SPWeb web = site.OpenWeb()) {   SPWebApplication oweb = web.Site.WebApplication; site.AllowUnsafeUpdates = true;   SPSiteCollection sitecol = oweb.Sites;   SPSite site1 = oweb.Sites.Add("sites/DemoSiteCol", "DemoSiteCol", "Welcome to the Client SiteCol",1033, "STS#0", "Domian\\user", "display name", "user@domian.com");//here i am getting the error message as "Object refernce not set to an instance of an Object". oweb.Update(); } Please tell me why i am getting the error message.... thanks in advance.....

Xsltlistviewwebpart social tagging error on cross site list

Hi! I have exported an xsltslistviewwebpart through SPD 2010 and when asked if I want to show a specific list or parent path I choose specfic. I then import the webpart file on another site and this show the list perfect with ribbon and everything. But when I click the social tagging & notes I get a new popup with a error message in: "The page you selected contains a list that does not exist.  It may have been deleted by another user.<nativehr>0x81020026</nativehr><nativestack></nativestack>" This is the same error that I get if I try to import a xsltlistviewwebpart without making the correct export. If I click this button on the original listview I dont get the error and I can add tags. The same problems goes for the I like button.Findwise AB

Error in attaching database file and creating a new connection

I am having problem when i was trying to attach .mdf file while create a new connection of SQL server, create a new connection of SQL database file and open the database in Server Explorer. I am using VS 2010 Ultimate and SQL Express 2008 R2.Can anyone please tell me what is the problem I am facing?Here are the error message.1. Attach .mdf in SQL database file and open the database in Server Explorer2. Create a new SQL server and attach .mdf
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend