我使用visual C#构建产品编辑器网页。我使用fancybox弹出了一个图片上传器,我需要从我的fancybox获取信息,一旦提交回到第一页而不清除任何信息。我知道我需要使用ajax,但我该怎么办呢?
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="uploader.aspx.cs" Inherits="uploader" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
<title></title>
</head>
<body style="width:350px; height:70px;">
<form id="form1" runat="server">
<asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager>
<div>
<div style="width:312px; height:20px; background-color:Gray; color:White; padding-left:8px; margin-bottom:4px; text-transform:uppercase; font-weight:bold;">Uploader</div>
<asp:FileUpload id="fileUp" runat="server" />
<asp:Button runat="server" id="UploadButton" text="Upload" onclick="UploadButton_Click" />
<br /><asp:Label ID="txtFile" runat="server"></asp:Label>
<div style="width:312px; height:15px; background-color:#CCCCCC; color:#4d4d4d; padding-right:8px; margin-top:4px; text-align:right; font-size:x-small;">Click upload to insert your image into your product</div>
</div>
</form>
</body>
</html>
到目前为止CS
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Configuration; // Add to page
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data; // Add to the page
using System.Data.SqlClient; // Add to the page
using System.Text; // Add to Page
public partial class uploader : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void UploadButton_Click(object sender, EventArgs e)
{
if (fileUp.HasFile)
try
{
fileUp.SaveAs("\\\\london\\users\\DP006\\Websites\\images\\" +
fileUp.FileName);
string imagePath = fileUp.PostedFile.FileName;
}
catch (Exception ex)
{
txtFile.Text = "ERROR: " + ex.Message.ToString();
}
finally
{
}
else
{
txtFile.Text = "You have not specified a file.";
}
}
}