![](/img/trans.png)
[英]How to pass a value from one frame and receive in another frame in asp.net C#?
[英]How to return a value from one class to another in C# (ASP.NET 2.0)
我有一個帶有代碼的類(簡體):
namespace CustomerData
{
public class InsertCustomer
{
public string name { get; set; }
public string customerID { get; set; }
public string Add()
{
//Insert into a database
//Condition to check if the insert was successfull
if (successful)
{
return id;
}
else
{
//If the insert was not successfull
}
}
}
}
現在,我想以與上述類相同的解決方案(簡化代碼)將此值傳遞給我的Web服務(ASP.NET 2.0):
namespace CustomerData
{
[WebService(Namespace = "http://tempuri.org/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
[System.ComponentModel.ToolboxItem(false)]
[System.Web.Script.Services.ScriptService]
[WebMethod]
public string deleteCustomer(string customerID)
{
return customerID;
}
然后本質上,我想要一個AJAX GET函數來獲取此ID並使用此變量執行一個函數,但是如果我可以將值獲取到WebMethod中,那么我認為我會從中受益的。
關於如何執行主題描述的任何建議? 提前致謝。
您是否考慮過從InsertCustomer類調用Web方法?
CustomWebService srv = new CustomWebService;
srv.deleteCustomer(returnedCustomerID);
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.