Jquery mobile aspx服务器端jquery或javascript window.location.hash='pg2';如果启用了jquery库,则不执行
如果脚本src=http://code.jquery.com/jquery-1.7.1.min.js 如果在aspx页面中启用了,那么以下代码将不会在aspx.cs页面中执行,如果禁用jquery,那么代码工作正常。问题代码位于代码背后的iPostBack中: aspx: aspx.cs:Jquery mobile aspx服务器端jquery或javascript window.location.hash='pg2';如果启用了jquery库,则不执行,jquery-mobile,asp.net-mvc-4,Jquery Mobile,Asp.net Mvc 4,如果脚本src=http://code.jquery.com/jquery-1.7.1.min.js 如果在aspx页面中启用了,那么以下代码将不会在aspx.cs页面中执行,如果禁用jquery,那么代码工作正常。问题代码位于代码背后的iPostBack中: aspx: aspx.cs: using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Configuration;
using System.Data;
using System.Data.SqlClient;
public partial class client_mobile_tickets_resolution_finder : System.Web.UI.Page
{
public int uid;
public static DataTable dt;
public string serverName;
public string timeout;
public int rowCount;
protected void Page_Load(object sender, EventArgs e)
{
if (IsPostBack)
{
//--ClientScript.RegisterStartupScript(this.GetType(), "hash", "window.location.hash='#pg2';", true);
ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "tmp", "<script type='text/javascript'>showResults();</script>", false);
}
serverName = HttpContext.Current.Request.Url.Scheme + "://" + HttpContext.Current.Request.Url.Authority; // + HttpContext.Current.Request.ApplicationPath;
//Get uid
uid = int.Parse(Request.QueryString["uid"]);
//Open database connection
SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["mobile"].ConnectionString);
try
{
conn.Open();
////-- Test to be sure db is open
if (conn.State == ConnectionState.Open)
{
//--Get Home screen data
SqlDataAdapter ad = new SqlDataAdapter("get_mobile_server_info_p", conn);
DataSet ds = new DataSet();
ad.Fill(ds, "dsResult");
dt = ds.Tables[0];
timeout = dt.Rows[0][2].ToString();
}
else
{
Response.Write("Error..... Could not open dataset....");
Response.End();
}
}
finally
{
conn.Close();
conn.Dispose();
}
}
protected void cmdGo_Click(object sender, EventArgs e)
{
//--Get actions for selected issue
//Open database connection
SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["mobile"].ConnectionString);
try
{
conn.Open();
////-- Test to be sure db is open
if (conn.State == ConnectionState.Open)
{
//--Get resolutions
SqlDataAdapter ad = new SqlDataAdapter("get_sl_actions_for_issue_p '" + ddlSubject.SelectedValue + "'", conn);
DataSet ds = new DataSet();
ad.Fill(ds, "dsResult");
dt = ds.Tables[0];
rowCount = dt.Rows.Count;
//-- Populate the results
DataTable newsDataTable = new DataTable();
// add some columns to our datatable
newsDataTable.Columns.Add("href_li");
newsDataTable.Columns.Add("DisplayText");
for (int i = 1; i < dt.Rows.Count; i++)
{
DataRow newsDataRow = newsDataTable.NewRow();
newsDataRow["href_li"] = i;
newsDataRow["DisplayText"] = dt.Rows[i][0].ToString();
newsDataTable.Rows.Add(newsDataRow);
}
menu_ul_1.DataSource = newsDataTable;
menu_ul_1.DataBind();
//--Navigate to the 2nd page
//--this.ClientScript.RegisterStartupScript(this.GetType(),"navigate", "window.location.hash='#pg2';",true);
//--Response.RedirectPermanent("resolution_finder.aspx?uid=" + uid + "#pg2");
}
else
{
Response.Write("Error..... Could not open dataset....");
Response.End();
}
}
finally
{
conn.Close();
conn.Dispose();
}
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Configuration;
using System.Data;
using System.Data.SqlClient;
public partial class client_mobile_tickets_resolution_finder : System.Web.UI.Page
{
public int uid;
public static DataTable dt;
public string serverName;
public string timeout;
public int rowCount;
protected void Page_Load(object sender, EventArgs e)
{
if (IsPostBack)
{
//--ClientScript.RegisterStartupScript(this.GetType(), "hash", "window.location.hash='#pg2';", true);
ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "tmp", "<script type='text/javascript'>showResults();</script>", false);
}
serverName = HttpContext.Current.Request.Url.Scheme + "://" + HttpContext.Current.Request.Url.Authority; // + HttpContext.Current.Request.ApplicationPath;
//Get uid
uid = int.Parse(Request.QueryString["uid"]);
//Open database connection
SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["mobile"].ConnectionString);
try
{
conn.Open();
////-- Test to be sure db is open
if (conn.State == ConnectionState.Open)
{
//--Get Home screen data
SqlDataAdapter ad = new SqlDataAdapter("get_mobile_server_info_p", conn);
DataSet ds = new DataSet();
ad.Fill(ds, "dsResult");
dt = ds.Tables[0];
timeout = dt.Rows[0][2].ToString();
}
else
{
Response.Write("Error..... Could not open dataset....");
Response.End();
}
}
finally
{
conn.Close();
conn.Dispose();
}
}
protected void cmdGo_Click(object sender, EventArgs e)
{
//--Get actions for selected issue
//Open database connection
SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["mobile"].ConnectionString);
try
{
conn.Open();
////-- Test to be sure db is open
if (conn.State == ConnectionState.Open)
{
//--Get resolutions
SqlDataAdapter ad = new SqlDataAdapter("get_sl_actions_for_issue_p '" + ddlSubject.SelectedValue + "'", conn);
DataSet ds = new DataSet();
ad.Fill(ds, "dsResult");
dt = ds.Tables[0];
rowCount = dt.Rows.Count;
//-- Populate the results
DataTable newsDataTable = new DataTable();
// add some columns to our datatable
newsDataTable.Columns.Add("href_li");
newsDataTable.Columns.Add("DisplayText");
for (int i = 1; i < dt.Rows.Count; i++)
{
DataRow newsDataRow = newsDataTable.NewRow();
newsDataRow["href_li"] = i;
newsDataRow["DisplayText"] = dt.Rows[i][0].ToString();
newsDataTable.Rows.Add(newsDataRow);
}
menu_ul_1.DataSource = newsDataTable;
menu_ul_1.DataBind();
//--Navigate to the 2nd page
//--this.ClientScript.RegisterStartupScript(this.GetType(),"navigate", "window.location.hash='#pg2';",true);
//--Response.RedirectPermanent("resolution_finder.aspx?uid=" + uid + "#pg2");
}
else
{
Response.Write("Error..... Could not open dataset....");
Response.End();
}
}
finally
{
conn.Close();
conn.Dispose();
}
}
}