问题描述
我正在使用一个名为SearchBox.dll的dll,它将使用MSNWebService在整个网站中进行搜索并向我返回结果.
http://www.asp.net/community/control-gallery/Item.aspx?i=1419
我想在Web服务中使用它.
这是我的代码
使用ControlFreak;
[WebMethod(EnableSession = true)]
公共无效的CallWebService()
{
试试
{
SearchBox objSB = new SearchBox();
objSB.SearchProvider = SearchBox.SearchProviderEnum.MSNWebService;
objSB.ShowSearchOptions = false;
objSB.SearchSite ="www.dell.com";
objSB.SearchSiteOnly = true;
objSB.Search("laptop");
objSB.SearchResultsReady + =新的SearchBox.SearchResultsReadyEventHandler(objSB_SearchResultsReady);
}
catch(ex ex例外)
{
字符串str = ex.Message;
}
}
void objSB_SearchResultsReady(DataTable SearchResults)
{
DataTable dt = new DataTable();
dt = SearchResults;
}
有人可以告诉我如何引发事件objSB_SearchResultsReady
在此先感谢
Hi,
I am using a dll called SearchBox.dll which will search across web sites using MSNWebService and return me the results.
http://www.asp.net/community/control-gallery/Item.aspx?i=1419
i want to use this in a web service.
here is my code
using ControlFreak;
[WebMethod(EnableSession = true)]
public void CallWebService()
{
try
{
SearchBox objSB = new SearchBox();
objSB.SearchProvider = SearchBox.SearchProviderEnum.MSNWebService;
objSB.ShowSearchOptions = false;
objSB.SearchSite = "www.dell.com";
objSB.SearchSiteOnly = true;
objSB.Search("laptop");
objSB.SearchResultsReady += new SearchBox.SearchResultsReadyEventHandler(objSB_SearchResultsReady);
}
catch (Exception ex)
{
string str = ex.Message;
}
}
void objSB_SearchResultsReady(DataTable SearchResults)
{
DataTable dt = new DataTable();
dt = SearchResults;
}
Can somebody please tell me how to raise the event objSB_SearchResultsReady
thanks in advance
推荐答案
这篇关于如何在Web服务中引发事件以动态创建控件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!