Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/vb.net/16.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Vb.net 在页面回调中加载iFrame_Vb.net_Iframe_Callback_Aspxgridview - Fatal编程技术网

Vb.net 在页面回调中加载iFrame

Vb.net 在页面回调中加载iFrame,vb.net,iframe,callback,aspxgridview,Vb.net,Iframe,Callback,Aspxgridview,我正在寻找一种方法,在ASPxGridView中的GridViewCommandColumnCustomButton触发回调时,将PDF文件加载到iFrame。原因是我需要根据单击的ASPxGridView上的哪一行加载不同的PDF 以下是我目前(未成功)处理回调的方式: Protected Sub grid_CustomButtonCallback(ByVal sender As Object, ByVal e As DevExpress.Web.ASPxGridView.ASPxGridVi

我正在寻找一种方法,在ASPxGridView中的GridViewCommandColumnCustomButton触发回调时,将PDF文件加载到iFrame。原因是我需要根据单击的ASPxGridView上的哪一行加载不同的PDF

以下是我目前(未成功)处理回调的方式:

Protected Sub grid_CustomButtonCallback(ByVal sender As Object, ByVal e As DevExpress.Web.ASPxGridView.ASPxGridViewCustomButtonCallbackEventArgs)
    If e.ButtonID = "bnPreview" Then
        Dim grid As ASPxGridView = CType(sender, ASPxGridView)
        Dim key As Object = grid.GetRowValues(e.VisibleIndex, grid.KeyFieldName)
        Dim sFile = UploadReportHelper.GetReport(key)
        If sFile <> "" Then
            frame_preview.Attributes("src") = sFile
        End If 
    End If
End Sub
受保护的子网格\u CustomButtonCallback(ByVal发送者作为对象,ByVal e作为DevExpress.Web.ASPxGridView.ASPxGridViewCustomButtonCallbackEventArgs)
如果e.ButtonID=“bnPreview”,则
按ASPxGridView=CType调整网格尺寸(发送方,ASPxGridView)
Dim key As Object=grid.GetRowValues(例如VisibleIndex、grid.KeyFieldName)
Dim sFile=UploadReportHelper.GetReport(键)
如果是文件“”,则
frame_preview.Attributes(“src”)=sFile
如果结束
如果结束
端接头

有什么想法吗?

您的页面必须有其他阻止其更新iframe的内容。如果你将它隔离到另一个项目中,它就会工作。我刚刚创建了一个新项目并进行了测试。下面的工作

HTML:


您的浏览器不支持iFrame
代码隐藏:

Protected Sub myButton\u单击(发件人作为对象,
e作为System.EventArgs)处理myButton。单击
myFrame.Attributes(“src”)=“http://microsoft.com"
端接头

根据说明OP正在使用UpdatePanel的注释进行编辑 在这种情况下,只需将
UpdatePanel
上的
UpdateMode
设置为
Conditional
,然后在CodeBehind中调用
UpdatePanel
.Update()
方法,如下所示

HTML:



今天的日期:

您的浏览器不支持iFrame

代码隐藏:

Protected Sub myButton\u单击(发件人作为对象,
e作为System.EventArgs)处理myButton。单击
myFrame.Attributes(“src”)=“http://microsoft.com"
myUpdatePanel.Update()
端接头

我想你把
回调
回发
搞混了。GridViewCommandColumnCustomButton不会像aspButton那样在单击时导致回发。如果它是异步完成的,则仍然是部分回发,或者您是说您永远不会返回服务器?如果导致部分回发,则必须有一种方法从服务器更新客户端。你用什么方法
UpdatePanel
s?你说得对,我正在使用
UpdatePanel
,但忘了为它设置触发器。在这种情况下,你会如何编写触发器?很简单。。。您只需调用
更新面板的
.Update()
方法
谢谢您的更新,这正是我想要的,但是在进行更改之后,更新面板仍然没有刷新。明天早上我会更详细地研究这个问题,并会不断更新这个问题。