也许又是后之后觉,事情是这个样子地。
昨天看了看DNN,弄了个google search,今天,想把它完成,一定要用google的WSDL了,用wsdl.exe生成了一个C#代码,其中result里有一个ResultElement的数组,就要用datagrid绑它,呵呵,可以免去写分页的麻烦何乐而不为呢?
于是有了以下代码
GoogleSearchService service = new GoogleSearchService();

GoogleSearchResult result = service.doGoogleSearch (ConfigurationSettings.AppSettings["GoogleKey"],
this.queryTextBox.Text,
0,
10,
false,
"",
false,
"",
"UTF-8",
"UTF-8");

this.resultList.DataSource = result.resultElements;
this.resultList.DataBind();
绑定写成这样<%# DataBinder.Eval(Container.DataItem,"summary") %>
summary就是ResultElement的一个Field,怎么弄也弄不过去,无奈新建了一个工程试试该怎么绑
![]()
.resultList.DataBind();
当TheElement类的定义是这样的时候,异常。
public class TheElement
}
当TheElement类的定义改成这样的时候,OK。
public class TheElement
搞不懂,为什么不让绑Field
。
相关文章: