看过类似问题的答案,但对于我的生活,我无法弄清楚我做错了什么.
我有两个文本框和一个按钮.当文本添加到第一个文本框并按下按钮时,我想将第一个文本框的值/文本应用于第二个文本框:
<html>
<head>
<script type="text/javascript" src="jquery.js"></script>
<script>
$("#button").click(function() {
var contents = $("#textbox").val();
$("#container").val(contents);
});
</script>
</head>
<body>
<input type="text" id="textbox" /> <input type="submit" id="button" value="Press This" />
<br />
<input type="text" id="container" />
</body>
</html>
Run Code Online (Sandbox Code Playgroud) 我正在练习在同一解决方案中使用WCF和两个项目.该服务应该从northwnd db获取信息,客户端显示它.
一切都工作正常,直到我向我的接口/合同添加了一个新的方法存根,GetSelectedCustomer(string companyName)
.
我已经实现了界面(使用智能标签确定).一切都编好了.但是,当从客户端的代码隐藏调用该方法时,它会抛出一个NotImplementedException
.
我发现的唯一看起来很奇怪的是,在intellisense中,图标GetSelectedCustomer
是内部方法的图标,而其他图标则具有通常的公共方法图标.我不确定为什么会这样.
我的界面:
[ServiceContract(Namespace = "http://localhost/NorthWndSrv/")]
public interface INorthWndSrv
{
[OperationContract]
Customer GetSingleCustomer(string custID);
[OperationContract]
Customer GetSelectedCustomer(string companyName);
[OperationContract]
List<Customer> GetAllCustomers();
[OperationContract]
List<string> GetCustomerIDs();
}
[DataContract]
public partial class Customer
{
[DataMember]
public string Company { get; set; }
[DataMember]
public string Contact { get; set; }
[DataMember]
public string CityName { get; set; }
[DataMember]
public string CountryName { get; set; }
}
Run Code Online (Sandbox Code Playgroud)
实施:
public class NorthWndSrv: INorthWndSrv
{ …
Run Code Online (Sandbox Code Playgroud)