求帮忙看看,怎么一直报错

两仪式啃西瓜 2014-12-29 11:07:02
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="cityTest.aspx.cs" Inherits="DTcms.Web.admin.city.cityTest" %>

<!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 runat="server">
<title>城市</title>
<script type="text/javascript" src="../../scripts/jquery/jquery-1.10.2.min.js"></script>

<script type="text/javascript">
function GetCityInfo(proId, level) {
$.ajax({
type: "GET",
url: "../../tools/city_ajax.ashx?type=GetCityInfo" + "&proId=" + proId + "&level=" + level,
data: "",
beforeSend: function () { },
success: function (msg) {
switch (level) {
case 1:
$("#spCity").html(msg);
break;
default:
break;
}

},
error: function () { alert("有问题,改改试试"); },
complete: function () { }
});
}
function ChangeSelect(proId, name) {
switch (name) {
case "<%=ddlProvince.ClientID%>":
GetCityInfo(proId, 1);
break;
default:
break;
}
}
</script>
</head>
<body>
<form id="form1" runat="server">
<div>
<span id="spProvince">
<asp:DropDownList ID="ddlProvince" runat="server" onchange="ChangeSelect(this.options[this.selectedIndex].value,this.name)" >
</asp:DropDownList>
</span>
<span id="spCity">

</span>
</div>
</form>
</body>
</html>
...全文
79 5 打赏 收藏 转发到动态 举报
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
两仪式啃西瓜 2014-12-29
  • 打赏
  • 举报
回复
引用 4 楼 wind_cloud2011 的回复:
你在后台设断点来调试,查一下数据读取,看在哪一步出错
现在倒是不报错了,但是结果还是显示不出来, ,我在后台打了断点,但是为什么点击 在浏览器查看后 ,断点没有效果
wind_cloud2011 2014-12-29
  • 打赏
  • 举报
回复
你在后台设断点来调试,查一下数据读取,看在哪一步出错
两仪式啃西瓜 2014-12-29
  • 打赏
  • 举报
回复
上面就是前台,还有ashx的代码
两仪式啃西瓜 2014-12-29
  • 打赏
  • 举报
回复
两仪式啃西瓜 2014-12-29
  • 打赏
  • 举报
回复
using System; using System.Collections.Generic; using System.Web; using System.Text; using System.Data; namespace DTcms.Web.tools { /// <summary> /// city_ajax 的摘要说明 /// </summary> public class city_ajax : IHttpHandler { public void ProcessRequest(HttpContext context) { if (!string.IsNullOrEmpty(context.Request.QueryString["type"])) { switch (context.Request.QueryString["type"]) { case "GetCityInfo": GetCityInfo(context); break; default: break; } } } public void GetCityInfo(HttpContext context) { if (!string.IsNullOrEmpty(context.Request.QueryString["proId"]) && !string.IsNullOrEmpty(context.Request.QueryString["level"])) { string controlName = ""; switch (context.Request.QueryString["level"]) { case "1": controlName = "ddlCity"; break; default: return; } BLL.dt_city bll = new BLL.dt_city(); DataSet ds = bll.CityGetList(int.Parse(context.Request.QueryString["proId"])); DataTable dt = ds.Tables[0]; StringBuilder sb = new StringBuilder(); sb.Append(String.Format("<select name=\"{0}\" ", controlName)); sb.Append("<option value=\"0\">未选择</option>"); foreach (DataRow row in dt.Rows) { sb.Append("<option value=\""); sb.Append(row["id"].ToString()); sb.Append("\">"); sb.Append(row["name"].ToString()); sb.Append("</option>"); } sb.Append("</select>"); context.Response.Write(sb.ToString()); } } public bool IsReusable { get { return false; } } } }

110,499

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 C#
社区管理员
  • C#
  • Web++
  • by_封爱
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

让您成为最强悍的C#开发者

试试用AI创作助手写篇文章吧