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

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

WebPart Issue

Posted By:      Posted Date: April 14, 2011    Points: 0   Category :C#


I am using this code to create a new web part.

// Get a reference to a web and a list
SPSite site = new SPSite("http://localhost:8000");
SPWeb web = site.OpenWeb();
SPList list = web.Lists["Contacts"];

// Instantiate the web part
ListViewWebPart wp = new ListViewWebPart();
wp.ZoneID = "Left";
wp.ListName = list.ID.ToString("B").ToUpper();
wp.ViewGuid = list.DefaultView.ID.ToString("B").ToUpper();

// Get the web part collection
SPWebPartCollection coll = 

// Add the web part

However, I get this error... List does not exist The page you selected contains a list that does not exist. It may have been deleted by another user

Why is this? Thanks.

View Complete Post

More Related Resource Links

Issue with Web capture webpart configuration


I have a requirement to display a specific are of page.
I think we can do it by using web capture webpart. when i try to modify the properties of webcapture webpart it prompts an message"Cannot create or modify Web Capture. Make sure that your browser supports ActiveX controls , that you have enabled them, and that you have installed the Web Capture ActiveX control".
I have installed "owc11" coponent but of no use. i am using IE 7...

can anyone please suggest how to solve this issue?


Multilingual Interface (Hindi) custom, webpart issue disappearance in share point 2007

Hi This is regarding the disappearance of custom  web parts in the multilingual site developed using MOSS 2007. The multilingual feature has been implemented using variations. All the custom web parts disappear when viewed after some time.  When the custom web parts are deployed to the site, it appears and they disappear when viewed after some time.  I have done local deployment as well as GAC deployment of the web parts dll. Both have the same effect. I have added the respective resource files for the web parts in the user control folder.    Thanks In Advance uttam  

Custom Search WebPart issue with apostrophe


I have a custom search webpart which returns the results based on the search input from a text box. The search is performed on a managed property called "CustomerName". When the customer name has apostrophe " ' " in its text, the search results are not returned because of the wrong query formation. 

I need to use a escape sequence and pass the search query. Can anyone help me how to form the query for this ?

Example: Customer name : A'BCD

Listview Webpart "rootFolder" private property issue in sharepoint 2010


We have used listview webpart to display document library.

The ListViewWebPart contains a private variable called 'rootFolder' that contains the current folder the webpart is displaying.

Below code snippet is used to obtain the value of the private variable contained within the ListViewWebPart.

private static object GetPrivateFieldValue(object obj, string fieldName)


    FieldInfo fi = obj.GetType().GetField(fieldName,

                            System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.NonPublic);


    return fi.GetValue(obj);



However, This is

WebPart DropDownList Control SelectIndexChanged Event Issue



In the below SharePoint WebPart, when I select the DropDownList control the SelectIndexChanged event does not get fired. The page reloads!

Why is this?


using System;
using System.Collections.Generic;
using System.Runtime.InteropServices;
using System.Web.UI;
using System.Web.UI.WebControls.WebParts;

using Microsoft.SharePoint;
using Microsoft.SharePoint.WebControls;
using Microsoft.SharePoint.WebPartPages;
using System.Web.UI.WebControls;
using System.Data;

namespace ActiveDirectoryWSP
  public class UnlockUser : Microsoft.SharePoint.WebPartPages.WebPart
    //control definitions
    protected DropDownList myList;
    //non control definitions

Issue with Sum and Average of column values in a BDC Webpart


I have retrieved data from SQL server using business data list webpart .Now,I have to take the sum and average of few column values.I am using SPD 2010 to add an additional row where I can store the sum and avg values.On the added row,When I trying to use insert formula,I cannot see that option available.And also I cannot see option to 'create, for conditional formatting.Can any one suggest me about how I can store the values for sum and avg's of the columns in a BDC webpart.

How do we generally get the sum and averages of the column in the BDC Webpart??

Site Users Webpart - Add New User link Issue


Hi All,

We are using SharePoint OOTB Site Users webpart to display all the users in the respectives SharePoint groups. Its working fine. But, when we logged in as a user who has a member of visitors or members SharePoint groups, the user can able to see the "Add New User" link. Eventually, the link should not be displayed for members and visitors group.

Could any one face this issue? Is this bug in the SharePoint itself?

Kindly suggest.


Chandrasekaran C N


Issue Displaying Data from Oracle using Business Data List WebPart


I have issue retrieving data from a remote oracle database using Business Data List WebPart. I have created an BDC definition
file using the BDC Meta Man tool. Then I imported this defination file into the Shared Services, so no issue it successfully
imported the file.

Now when I try to display the data using Business Data List WebPart, it fails to display any data. It gets the column headings
but no data. I get an error stating "An error occurred while retrieving data from OracleInstance. Administrators, see the server
log for more information."

The SharePoint log has the following exception:

Exception handed to HandleRuntimeException.HandleException System.Exception: System.Data.OracleClient requires Oracle client software version 8.1.7 or greater.     at System.Data.OracleClient.OCI.DetermineClientVersion()     at System.Data.OracleClient.OracleInternalConnection.OpenOnLocalTransaction(String userName, String password, String serverName, Boolean integratedSecurity, Boolean unicode, Boolean omitOracleConnectionName)     at System.Data.OracleClient.OracleInternalConnection..ctor(OracleConnectionString connectionOptions)     at System.Data.OracleClient.OracleConnectionFactory.CreateConnection(DbConnectionOptions options, Object poolGroupProviderInfo, DbConnectionPool pool, DbConn

Sharepoint 2010 w/ Webapps, Excel Services Webpart display issue.


I have Sharepoint 2010 installed with WebApps 2010, and can use it to edit documents in IE without any problems at all.  Word and Excel work just fine.

But on MOSS 2007, I could have it display the Excel page as a webpart, that you can click on, and open it anyways.   But no matter what I try in 2010, all I get is the Webpart heading has a link to the file that works, but the contents always reads:

To display a workbook in this Web Part, you must first select the workbook.

To select a workbook, open the tool pane, and then edit the Workbook property.
Click here to open the tool pane.


How can I fix the preview in the webpart?




IsapiModule Error 500 Issue


I am about exhausted trying to figure out this error:

HTTP Error 500.0 - Internal Server Error

Description: The page cannot be displayed because an internal server error has occurred.

Error Code: 0x8007007b

Notification: ExecuteRequestHandler

Module: IsapiModule

Requested URL: http://localhost:80/ReportServer

Physical Path: c:\Program Files\Microsoft SQL Server\MSSQL.2\Reporting Services\ReportServer

When I enable Failed Request Tracing Rules and view the log output I am supposing that the actual problem is in the 2nd call where there are 2 backslashes before the actual filename in the specified path:


CALL_ISAPI_EXTENSION DllName="C:\Windows\Microsoft.NET\Framework\v2.0.50727\\aspnet_isapi.dll"


MVC2 issue - Stuck. Trying to create a cms with nested partials


I am currently trying to display multiple items on a single page. I am not sure as to how to tackle this. What I have is a database table that has all the page data in. I have this run as a PagesController and this works fine. However what I would like to do is, if say the Products page is selected via the menu, I want to pull back not only the Products page html but also get all the products, and even be able to pull them through via category. I was trying to use a partial view, but I can't get it to work. The same would be for other pages, having partial views to display the other content, ie if Gallery is selected, the page html for Gallery shows and it then can push to a partial view that pulls all the gallery images from the gallery db table and so on. 

Maybe I am tackling this the wrong way. I have the pages stored in the db to allow for a CMS system I have setup. Maybe I need to use models for all the other items(Products, Gallery, Videos and such) and use the partial for the page html?

Any help would be greatly appreciated as I am confused.

xpath issue


Hi i am using xpath to loop through each node,

the xml is below i can get the value of "link" but i cant get the thumbnail value, have you got any ideas how i can do this, my code is below.



     <link>test 1</link>
     <media:thumbnail url="http://test.com/image.jpg" height="75" width="75" />



     <link>test 2</link>
     <media:thumbnail url="http://test.com/image.jpg" height="75" width="75" />


public void FindLinks(XPathNavigator p_xPathNav, DataTable dt)
            //run the XPath query
            XPathNodeIterator xPathIt = p_xPathNav.Select("//item");

            //use the

User validation Issue in xlsx file



I am validating user from Login.xlsx file. It was working fine by validating email and password from that file. For testing i got new file same contents of file but added some more user names.

So after that when i validating the user i am getting the following error "Data type mismatch in criteria expression".

But when i replaced the new to old one it is working fine. The contens of both files are the same. So why this kind of error happened.


Multiple Paramatized Threading issue


I need the funcitonality to have two methods run concurrently of each other and the parent thread (aka the method that makes these two calls) to halt until BOTH are done. After the threads are done, I need to perform logic on the returns of the method, so it is essential for both of them to be complete before the parent thread continues. I have searched the internet and tried varous attacks, and I always come up with the same result, this being the parent thread continues operation after the first thread finishes, leaving the second thread running.  Can someone show me a quick example of how I can do this. I have tried checking states of the threads, halting the threads, but I always end up with the same thing. Any help would be great. Thanks.

Data Truncation issue with Enterprise Library Logging WriteLog stored Proc


Hi ,

I'm using Enterprise Library Logging  feature for logging. The issue i am facing is when the Logging message is too large(more than 65534 chars) ,complete data  is not logged in the Formatted Mesage column which is  of data Type nText .

I am able insert complete data if i try inserting from Sql insert Query from sql management studio. Do i need to add any attributes to data base listener or do i need to change the sp.

 Is there any way to increase the WriteLog stored proc param size in EnterpriseLibrary.Logging config file ? . Please let me know.


Thanks In Advance.

Word Automation Issue in Windows Server 2008 Hosting



The problem I am posting here is that I was facing nearly 2 weeks around. Any body comes with this stuff please help.

Word Automation in sample ASP.NET(C#) application.

I am using Microsoft.Office.Inetrop.Word Assembly for automation. Here I am reading a XXX.dot template file and fill the contents with dynamic data.

When i am executing my code in localhost:someportnumber the automation is working fine and I could get expected result and when I am hosting in my inetmgr(Windows XP is my OS) it is also working fine.

But the problem is that when I am hosting in my production server(Windows Server 2008 Standard Edition) I am not able to perform automation and results in the following error.

Data: System.Collections.ListDictionaryInternal
Message: Word has encountered a problem.
Source: Microsoft Word

The code gets failed in the following line:

ApplicationClass wordApp = new Microsoft.Office.Interop.Word.ApplicationClass();

Document wordDoc = wordApp.Documents.Add(ref oTemplate, ref oFalse, ref oMissing, ref oMissing); // Error in this line

I cannot able to proceed further. Can anybody please help me in solving this issue?

Thank you.

With Regards,


If Statement Issue



This is very strange to me. I have spent 2hrs looking into this inside out , but dont seem to get it

I have an if statement that inserts data into the database. But i check to make sure the name is not entered twice. Now when the name is already in the db, then it should insert else put out a message saying its already in the db

My code works fine except that  when its not in the db, its inserts but still puts out the message that says "Name is already in use" Not sure if am not seeing something. But thought i did bring it to the forum. Here is my code...Pretty simple

Protected Sub btnAdd_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnAdd.Click

        Dim objConnection As SqlConnection
        Dim objCommand As SqlCommand
        Dim strSQLQuery1 As String


        ' If there's nothing to Add for then don't search
        ' o/w build our SQL Query and execute it.
        If String.IsNullOrEmpty(txtAdd.Text) Or Leadbank.SelectedValue = "000" Then


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