后跌进另一个障碍。现在我有一个包含Plupload
的页面和一个基本上从数据库中提取所有上传图像的中继器。此页面在colorbox
中动态加载。执行vb.net代码方法背后Plupload完成上传
我需要的是当新图像上传到数据库时,中继器要自行更新。我只需调用Repeater并将其绑定(Repeater1.Databind())即可。我非常肯定解决方案在于Ajax
,但我环顾四周,甚至用它们来调用Web服务,但是如何在方法后面执行代码?
背后,我想执行方法的代码是:
Public Sub reBind()
Dim dt2 As DataTable = blOrgLogo.getOrgLogo(userId, False).Tables(0)
If (dt2 Is Nothing) Or (dt2.Rows.Count = 0) Then
' Nothing is returned
Else
repLogoCollection.DataSource = dt2
repLogoCollection.DataBind()
End If
End Sub
一个例子,我看到在线状态这是可以做到使用PageMethods
但我不能让它使用上述方法工作。
我不能使用ASP.Net Ajax Timer
控件,因为当页面通过colorbox加载时,它似乎不工作。 (如果有人有这个解决方案,这将是真棒,因为这将简化一切哈哈)
另一条信息,我不知道可能有任何用处是中继器绑定在page_load。
Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load
userId = Session("UserID")
Dim dt As DataTable = blOrgLogo.getOrgLogo(userId, False).Tables(0)
If (Not IsPostBack) Then
If (dt Is Nothing) Or (dt.Rows.Count = 0) Then
' Nothing is returned
Else
Repeater1.DataSource = dt
Repeater1.DataBind()
End If
End If
End Sub
的Plupload的javascript:
// Client side form validation
$('#uploader').submit(function (e) {
var uploader = $('#uploader').pluploadQueue();
// Validate number of uploaded files
if (uploader.total.uploaded == 0) {
// Files in queue upload them first
if (uploader.files.length > 0) {
// When all files are uploaded submit form
uploader.bind('UploadProgress', function() {
if (uploader.total.uploaded == uploader.files.length)
$('form').submit();
});
uploader.start();
} else
alert('You must at least upload one file.');
e.preventDefault();
}
});
上传后为什么不重新加载页面?它似乎很复杂,你简单的任务做什么, – ppumkin 2012-07-11 16:00:28
的页面是在颜色框这就是为什么我想要做这种方式。但最有可能的是我会抛弃colorbox – 2012-07-12 13:24:45
好吧,它不是一个iframe或在colorbox中的东西?如果是这样iframe iframe ..如果它的ajaxed html ..然后重新ajax它? :) – ppumkin 2012-07-12 14:28:22