当某些条件不满足时,我正在使用 java 脚本使用警报消息来显示某种警告。我唯一的问题是当弹出警报消息并且用户阅读消息并单击“确定”时,它会返回到原始页面但页面会移动到左侧。通常我的页面显示在中心,但只有当 java 脚本运行时它才会移动到页面的左侧。如果我复制相同的 URL 并粘贴到另一个页面,那么所有内容都将对齐并显示在中心。我怎样才能解决这个问题?是否有另一个警报消息,如 jquery 或其他效果很好的东西。请。帮助。感恩
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net.Mail;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using System.Web.Security;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using AjaxControlToolkit;
using System.Data.SqlClient;
using System.Configuration;
using System.Collections;
using System.Web.Routing;
public partial class HomePage : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
string ID = Page.RouteData.Values["ID"] as string;
if (!IsPostBack)
{
BindData_Action();
}
}
protected void btnApproval_Click(object sender, EventArgs e)
{
SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["TestConnectionString"].ConnectionString);
SqlDataAdapter da = new SqlDataAdapter("SELECT ID, Description, Target_Date FROM MyTable WHERE ID = '" + Request.QueryString["ID"] + "'", con);
DataTable dt = new DataTable();
da.Fill(dt);
if (dt.Rows.Count > 0)
{
//if the condition above is true i am sending an email
}
else
{
Response.Write("<script>alert('Before requesting Approval additional info. Thanks');</script>");
}
}
}