我正在使用 Uploadify v2.1.4 使用 ASP.Net C# FM 4.0 上传图像。
在此页面中,我还有其他控件,但我想要一种功能,即当我上传图像时,它应该自动刷新 UpdatePanel1 以显示上传的图像
默认.aspx 文件
<asp:UpdatePanel ID="UpdatePanel1" runat="server" >
<ContentTemplate>
<asp:DataList ID="DataList1" runat="server" DataSourceID="SqlDataSource1" RepeatDirection="Horizontal" >
<ItemTemplate>
<br /><img src='http://test.kashmirsouq.com/ImageUploads/<%# Eval("ImageID") %>' width="100px" height="100px" vspace="2" hspace="2" border="1" />
<br /><asp:LinkButton ID="lnkBtnDeleteImage" CommandArgument='<%# Eval("sno") %>' CommandName="Delete" runat="server">
Delete</asp:LinkButton>
<br />
</ItemTemplate>
</asp:DataList>
<asp:SqlDataSource ID="SqlDataSource1" runat="server"
ConnectionString="<%$ ConnectionStrings:SQLConnectionString %>"
SelectCommand="SELECT [sno], [ImageID] FROM [User_Images]">
</asp:SqlDataSource>
</ContentTemplate>
</asp:UpdatePanel>
页面示例在这里 test.kashmirSouq.com
我正在调用 FileUplaad.aspx 文件以使用 jQuery 上传图像
<script type="text/javascript">
$(document).ready(function () {
$('#fuFiles').uploadify({
'uploader': 'Scripts/uploadify.swf',
'script': 'FileUploads.aspx',
'cancelImg': 'Scripts/cancel.png',
'auto': 'true',
'multi': 'true',
'fileExt': '*.jpg;*.gif;*.png',
'buttonText': 'Browse...',
'queueSizeLimit': 5,
'simUploadLimit': 2
});
});
</script>
在 FileUpload.aspx.cs 文件中,我将文件保存在服务器和数据库上,我需要一种方法,以便我可以从 FileUpload.aspx.cs 中的函数 saveData() 刷新 updatepanel1
protected int saveData()
{
String strSql = "INSERT INTO HMS_User_Images(ImageID,UserID,ImageCreationDate) ";
strSql += " VALUES ('" + filename + "','123456789', '" + DateTime.Now + "')";
int result = DataProvider.intConnect_Select(strSql);
}
因此,当我上传图像时,它应该刷新网格的部分页面更新。请给我一个例子,我如何使用 C# 做到这一点
请建议我如何执行此代码示例,我们将不胜感激。
问候