Solved

type or namespace could not be found

Posted on 2008-10-01
1
464 Views
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
{
[Guid("be6ec8e3-2706-4f52-bdf9-f6eb18fc65c0")]
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"))
{
Page.ClientScript.RegisterClientScriptInclude("JSON",
"/wpresources/json.js");
}
if (!Page.ClientScript.IsClientScriptBlockRegistered("Ajax"))
{
Page.ClientScript.RegisterClientScriptInclude("Ajax",
"/wpresources/ajax.js");
}
}
protected override void CreateChildControls()
{
try
{
string strPath = "/AskMe2/ContactService.asmx";
ServiceReference objReference = new ServiceReference();
objReference.Path = strPath;
Control ctlManager = Page.Master.FindControl("theScriptManager");
ScriptManager objManager = ctlManager as ScriptManager;
objManager.Services.Add(objReference);
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

0
Comment
Question by:kitesurf
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 7

Accepted Solution

by:
Rajendra Shekhawat earned 500 total points
ID: 22615243
Hi,

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.

Regards.

0

Featured Post

Office 365 Advanced Training for Admins

Special Offer:  Buy 1 course, get 2nd free!  Buy the 'Managing Office 365 Identities & Requirements' course w/ Accelerated TestPrep, and automatically receive the 'Enabling Office 365 Services' course FREE!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
VB.net/VSTO Excel Add-in 2 38
Sharepoint 2013 edit permissions powershell 8 55
MDT Create a bootable media for BIOS 2 23
How do I "share" on social sites? 2 38
More often than not, we developers are confronted with a need: a need to make some kind of magic happen via code. Whether it is for a client, for the boss, or for our own personal projects, the need must be satisfied. Most of the time, the Framework…
When using a search centre, I'm going to show you how to configure Sharepoint's search to only return results from the current site collection. Very useful when using Office 365 with multiple site collections.
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. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…

732 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