想输入客户名称,模糊查询出客户列表

huangqicai110 2008-11-24 08:36:20
想输入客户名称,模糊查询出客户列表,但我点击 查找客户详细信息 按钮,没反应,不知道哪里出问题,请高手看看。谢谢!

add_new_complaint.aspx

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="add_new_complaint.aspx.cs" Inherits="zy0769_admin_add_new_complaint" %>
<%@ Register TagPrefix="WebSession" TagName="CheckSession" Src="UserControls/session.ascx" %>
<WebSession:CheckSession id="CheckSession" runat="server"></WebSession:CheckSession>

<!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>
<link href="../../css/admin.css" rel="stylesheet" type="text/css" />
<style type="text/css">
<!--
#customer {
position:absolute;
left:117px;
top:9px;
width:578px;
height:227px;
z-index:1;
background-color: #64A8D9;
visibility: hidden;
}
-->
</style>
<script language="JavaScript" type="text/javascript">

var currentPos = false ;
var pp = false ;
//var theValue=form1.BtypeId.Text.ToString();
//var theValue=document.getElementById("BtypeId").text

function showCustomer(obj,theValue,sourcp){

if (theValue == "")
{
alert('请输入要查找的内容!') ;
form1.BtypeId.focus() ;
return false ;

}

document.getElementById(obj).style.visibility = "visible" ;
pp = obj ;
currentPos = sourcp ;
send_request("show_customer.aspx?find_customer=" + theValue) ;

return false;

}

function search_again()
{
send_request("show_customer.aspx") ;
}

function send_request(url){

http_request = false ;

if (window.XMLHttpRequest) {

http_request = new XMLHttpRequest() ;
if (http_request.overrideMimeType) {

http_request.overrideMimeType("text/xml") ;

}

} else if (window.ActiveXObject) {

try{

http_request = new ActiveXObject("Msxml2.XMLHTTP") ;

}catch(e){

try{

http_request = new ActiveXObject("Microsoft.XMLHTTP") ;

}catch(e){}

}

}


if (!http_request){

window.alert('不能创建XMLHttpRequest对象实例!') ;
return false ;

}

http_request.onreadystatechange = processRequest ;
http_request.open("GET",url,true) ;
http_request.send(null) ;


}


function processRequest(){

if (http_request.readyState == 4){

if (http_request.status == 200) {

//document.getElementById(currentPos).innerHTML = http_request.responseText;
document.getElementById(currentPos).innerHTML = http_request.getElementById(BtypeId);
document.getElementById(pp).style.visibility = "hidden" ;


}else{

alert("你所请求的页面有异常!") ;

}


}

}

</script>
</head>
<body>
<form id="form1" runat="server">
<div id="customer">
<table width="100%" height="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td align="center">正在查询客户资料列表,请耐心等候 .....</td>
</tr>
</table>
</div>
<table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td height="7"></td>
</tr>
</table>
<table width="96%" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td height="30" class="title_top" align="center">新建投诉单</td>
</tr>
</table>
<TABLE cellSpacing="1" cellPadding="3" width="96%" align="center" bgColor="#77aeee" border="0">
<tr>
<th align="right" bgcolor="#dfefff" width="120" style="height:25px">客户名称:</th>
<td bgcolor="#ffffff" id="shp">
<asp:TextBox ID="BtypeId" runat="server" Columns="70"></asp:TextBox><asp:Button
ID="Button2" runat="server" Text="查找客户详细信息" CausesValidation="False"/></td>
</tr>
<tr>
<th align="right" bgcolor="#dfefff" style="height:25px"></th>
<td bgcolor="#ffffff">
<asp:Button ID="Button1" runat="server" Text="确认" />  <input id="Reset1" type="reset" value="重填" /></td>
</tr>
</TABLE>
</form>
</body>
</html>


add_new_complaint.aspx.cs

using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

using AfterSales.BusinessLogicLayer;
using AfterSales.DataAccessHelper;
using AfterSales.CommonComponent;

public partial class zy0769_admin_add_new_complaint : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{

Button2.Attributes.Add("onclick", "return showCustomer('customer',BtypeId.Text.ToString(),'shp')");
//Button2.Attributes.Add("onclientclick", "return showCustomer('customer',theValue,'shp')");
//Button2.Attributes.Add("onclientclick", "showCustomer(customer," + BtypeId.Text.ToString() + ",shp)");
}


}


show_customer.aspx

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="show_customer.aspx.cs" Inherits="zy0769_admin_show_customer" %>

<!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>
</head>
<body>
<form id="form1" runat="server">
<asp:DropDownList ID="BtypeId" runat="server">
</asp:DropDownList>

</form>
</body>
</html>


show_customer.aspx.cs

using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

using AfterSales.BusinessLogicLayer;
using AfterSales.DataAccessHelper;
using AfterSales.CommonComponent;

public partial class zy0769_admin_show_customer : System.Web.UI.Page
{
public string find_customer;


protected void Page_Load(object sender, EventArgs e)
{
Query();
}

/// <summary>
/// 根据页面上用户输入的查询条件,查询用户资料
/// </summary>
private void Query()
{
find_customer = Convert.ToString(Request.QueryString["find_customer"]);
//find_customer = "83273353";

Hashtable queryItems = new Hashtable();
queryItems.Add("FullName", find_customer);
DataView dv = Btype.QueryFullName(queryItems);


BtypeId.DataValueField = dv.Table.Columns[0].Caption.ToString();
BtypeId.DataTextField = dv.Table.Columns[1].Caption.ToString();
BtypeId.DataSource = dv;
BtypeId.DataBind();

}
}
...全文
241 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
Even713 2008-11-25
  • 打赏
  • 举报
回复
帮顶~
wjfmail 2008-11-25
  • 打赏
  • 举报
回复
怎么可能有反应呢???你用的是asp:Button ;你又没写服务器端的onclick.看你的代码似乎是准备使用AJAX,那就应该用客户端的button,然后再写客户端的onclick.