gpt4 book ai didi

c# - 如何在 GridView 中打开 pdf

转载 作者:太空宇宙 更新时间:2023-11-03 15:55:49 25 4
gpt4 key购买 nike

我在更新面板内的 gridview 中遇到一些问题。当我在按钮的 gridview 行命令事件中使用此代码时:

    if (dr.Read())
{
Byte[] pdfData = (byte[])dr.GetValue(0); ;
Response.Buffer = true;
Response.ContentType = "application/PDF";
Response.BinaryWrite(pdfData);
// Response.End();
}

我单击@gridview 按钮(更新面板中的gridview)然后打开pdf 文件,但我从updatepanel 中删除gridview 然后gridview 按钮工作正常并打开文件。请建议如何管理 updatepanel 中的 gridview 按钮。

最佳答案

如果您在更新面板中将条件属性设置为 true,您可能需要将按钮添加为更新面板的触发器。

 <asp:UpdatePanel ID="UpdatePanel9" runat="server" UpdateMode="Conditional">
<ContentTemplate>
...your gridview...
</ContentTemplate>
<Triggers>
<asp:AsyncPostBackTrigger ControlID="yourbutton" />
</Triggers>
</asp:UpdatePanel>

关于c# - 如何在 GridView 中打开 pdf,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23678411/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com