下面是我正在尝试将数据插入到我的'ArticlesTBL'表中的代码.我还想将图像文件上传到mt计算机.以前我在Visual Studio中使用我的.aspx文件中的数据控件来插入数据,所以在C#中尝试这样做对我来说是新的.真的很感激任何帮助.谢谢.
我收到错误读取:'UploadedUserFiles'附近的语法不正确.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.IO;
using System.Data;
using System.Data.SqlClient;
using System.Web.Configuration;
public partial class _CopyOfSubmitArticle : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void uploadbutton_Click(object sender, EventArgs e)
{
string UpPath = Server.MapPath("~/UploadedUserFiles");
int imgSize = FileUpload1.PostedFile.ContentLength;
string imgName = FileUpload1.FileName;
string imgPath = "UploadedUserFiles/" + imgName;
if (FileUpload1.PostedFile.ContentLength > 1000000)
{
Page.ClientScript.RegisterClientScriptBlock(typeof(Page), "Alert", "alert('File is too big')", true);
}
else
{
FileUpload1.SaveAs(Server.MapPath(imgPath));
myinfo.Text …Run Code Online (Sandbox Code Playgroud) 我有一个 EventDetails.aspx 页面,其中包含我的用户可以使用 Timetable.aspx 页面中的 Window.Open() 打开的事件的详细信息。在 EventDetails.aspx 页面上,我有一个按钮,允许我使用以下代码关闭窗口:
protected void CloseWindow_Click(object sender, EventArgs eventArgs)
{
Response.Write("<script language='javascript'>window.open('','_self');window.close();</script>");
}
Run Code Online (Sandbox Code Playgroud)
当我从 Timetable.aspx 页面使用 Window.Open() 打开我的窗口时,关闭窗口按钮工作正常,但是如果我独立导航到 EventDetails.aspx 页面,我将无法使用关闭窗口按钮 - 没有任何反应!
有没有一种方法可以确定用户是否使用 Window.Open() 导航,以便我可以更改按钮的可见性,或者更好的是,是否有另一种方法可以关闭不依赖于使用 Window.Open() 的选项卡。打开()?