type or namespace could not be found

Posted on 2008-10-01
Last Modified: 2013-11-25
the last line(3)ServiceReference will not compile.  askme2 is a virtual on default web site port 55555 while sharepoint is on same box with port 80.  oh all this is on my development vm box. thanks.

try {

string strPath ="/askme2/contactservice.asmx";

ServiceReference objReference = new ServiceReference();

using System;

using System.Runtime.InteropServices;

using System.Web.UI;

using System.Web.UI.WebControls.WebParts;

using System.Xml.Serialization;

using Microsoft.SharePoint;

using Microsoft.SharePoint.WebControls;

using Microsoft.SharePoint.WebPartPages;

using System.Web.UI.WebControls;

namespace AjaxClientContactInfo



public class AjaxClientContactInfo : System.Web.UI.WebControls.WebParts.WebPart


public AjaxClientContactInfo()


PreRender += new EventHandler(PerformanceCounterWebPart_PreRender);


void PerformanceCounterWebPart_PreRender(object sender, EventArgs e)


if (!Page.ClientScript.IsClientScriptBlockRegistered("JSON"))





if (!Page.ClientScript.IsClientScriptBlockRegistered("Ajax"))






protected override void CreateChildControls()




string strPath = "/AskMe2/ContactService.asmx";

ServiceReference objReference = new ServiceReference();

objReference.Path = strPath;

Control ctlManager = Page.Master.FindControl("theScriptManager");

ScriptManager objManager = ctlManager as ScriptManager;


string strCompanyName = "Name: <input id=\"CompanyName\" type=\"text\" />";

Controls.Add(new LiteralControl(strCompanyName));

string strAutoFill = "<input id=\"AutoFill\" type=\"button\"value=\"AutoFill...\" onclick=\"AutoFillRequest();\" /><br/>";

Controls.Add(new LiteralControl(strAutoFill));

string strContactPerson = "Contact: <input id=\"ContactPerson\" type=\"text\" /><br/>";

Controls.Add(new LiteralControl(strContactPerson));

string strCity = "City: <input id=\"City\" type=\"text\" /><br/>";

Controls.Add(new LiteralControl(strCity));

string strCountry = "Country: <input id=\"Country\" type=\"text\" /><br/>";

Controls.Add(new LiteralControl(strCountry));


catch (Exception err)


Controls.Add(new LiteralControl(err.Message));





Open in new window

Question by:kitesurf
1 Comment

Accepted Solution

Rajendra Shekhawat earned 500 total points
ID: 22615243

I tested the code, and it was giving same exception, namespace not found.

I installed AJAX Extensions 1.0, as I am using Visual Studio 2005.
Adding the reference of System.Web.Extensions assembly to project, removes the exception.

Hopefully it resolves the issue, for you too.



Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Name space syntax error 12 44
Syntax Error 2 47
Not showing JavaScript in the list 5 40
C#.NET and microsoft certification. 3 34
Note:  There are two main ways to deploy InfoPath forms:  Server-side and directly through the SharePoint site.  Deploying a server-side InfoPath form means the form is approved by the Administrator, thus allowing greater functionality in the form. …
This article shows how to deploy dynamic backgrounds to computers depending on the aspect ratio of display
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA.…

867 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now