I tried to follow up Ram's suggestion and exported data in a GridView to a word documents by following code snippet:
代码
After building the project and try to view it in browser, however, the browser just told me the following message when clicking the Export data button:
After a quick search, I found: http://rstew.blogspot.com/2007/10/gridview-must-be-placed-inside-form-tag.html, great post, override the VerifyRenderingInServerForm method, the process works happily!
public override void VerifyRenderingInServerForm(Control control)
{
return;
}
在64位Vista机器上调用一个native的.dll 文件时, 经常会报这个错误:
这是因为我们的Configuration Manager没有配置好: 如果我们在64位机器上使用AnyCPU的配置,我们的程序可以加载anycpu.dll 和x64.dll, 但是, 如果我们试图加载x86.dll就会出现BadImageFormatException的错误。同样地, 如果我们使用的是x86的选项, 我们也会收到同样的消息--如果我们试图加载x64.dll的话。
在我的机器上, 由于native dll 文件是用Win32的platform来build的,所以我把manage的项目改到x86选项下(如果没有,我们可以新建一个)重新build后, 没有出现BadImageFormatException的对话框了, 不过我测试了一下, 这个方法对Windows Service的程序不太管用。
