Asp.net 使用从弹出页面到当前页面的数据输入并进行部分刷新
我正在使用visual C#构建产品编辑器网页。我有一个图像上传弹出使用fancybox,我需要从我的fancybox获得信息一旦提交返回到第一页,而不清除任何信息。我知道我需要使用ajax,但是我该怎么做呢Asp.net 使用从弹出页面到当前页面的数据输入并进行部分刷新,asp.net,ajax,Asp.net,Ajax,我正在使用visual C#构建产品编辑器网页。我有一个图像上传弹出使用fancybox,我需要从我的fancybox获得信息一旦提交返回到第一页,而不清除任何信息。我知道我需要使用ajax,但是我该怎么做呢 <%@ Page Language="C#" AutoEventWireup="true" CodeFile="uploader.aspx.cs" Inherits="uploader" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHT
<%@ 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>
我将其标记为迁移到堆栈溢出,他们将能够使用Fancybox的AJAX选项帮助将数据传递回您的页面。谢谢。我把它放在那里,但不确定它是否应该在这里是的,那里有更多的程序员,用fancybox、jquery和ajax以及asp.net标记你的文章。我有一个使用fancobox和ajax的php应用程序,但我的程序员没有在线帮助。
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.";
}
}
}