微信网页电话簿-jquery mobile 工具vs2010
前端:
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<meta name="viewport" content="width=device-width,initial-scale=1.0,maximum-scale=1.0,user-scalable=no"/>
<link rel="stylesheet" href="http://code.jquery.com/mobile/1.3.2/jquery.mobile-1.3.2.min.css">
<script src="http://code.jquery.com/jquery-1.8.3.min.js"></script>
<script src="http://code.jquery.com/mobile/1.3.2/jquery.mobile-1.3.2.min.js"></script>
<title>电话薄</title>
</head>
<body>
<form id="form1" runat="server">
<div data-role="page" id="pageone">
<div data-role="content">
<%-- <p>
<asp:Label ID="Label2" runat="server" Text="请输入姓名"></asp:Label>
</p>--%>
<h4>请输入员工准确姓名:</h4>
<p>
<asp:TextBox ID="TextBox1" runat="server" Font-Bold="True" Font-Size="Medium" ></asp:TextBox>
</p>
<asp:Button ID="Button1" runat="server" Text="查询" OnClick="Button1_Click" />
<h4>查询结果:</h4>
<ul data-role="listview" data-inset="true">
<% if (aa[0] == "1")
{%>
<li>未查到该员工的信息</li>
<% };%>
<% if (aa[0] != "1")
{%>
<li><%=aa[0] %></li>
<% };%>
<% if (aa[1] != "2")
{%>
<li><%=aa[1] %></li>
<% };%>
<% if (aa[2] != "3")
{%>
<li><%=aa[2] %></li>
<% };%>
</ul>
</div>
<div data-role="footer" class="ui-bar-b">
<h1>信息技术中心提供支持</h1>
</div>
</div>
</form>
</body>
</html>
后台
using System;
using System.Data;
using System.Configuration;
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 System.Data.SqlClient;
public partial class _Default : System.Web.UI.Page
{
public string[] aa = new string[3] { "", "2", "3", };
protected void Page_Load(object sender, EventArgs e)
{
}
protected void Button1_Click(object sender, EventArgs e)
{
aa[0] = "1";
aa[1] = "2";
aa[2] = "3";
string str = "data source=2*****7,1433;User ID=l888888s;pwd=l222222288;Initial Catalog=li3344B2s";
SqlConnection myConnection = new SqlConnection(str);
myConnection.Open();
string sqlStr = "select * from tel00 where xm = '" + TextBox1.Text + "' ";
SqlDataAdapter myDa = new SqlDataAdapter(sqlStr, myConnection);
DataSet myDs = new DataSet();
myDa.Fill(myDs);
//string[] arr = new string[myDs.Tables[0].Rows.Count];
for (int i = 0; i < myDs.Tables[0].Rows.Count; i++)
//for (int i = 0; i < myDs.Tables[0].Rows.Count; i++)
{
aa[i] = myDs.Tables[0].Rows[i][0].ToString() + "-" + myDs.Tables[0].Rows[i][1].ToString() + "-" + myDs.Tables[0].Rows[i][2].ToString() + "-" + myDs.Tables[0].Rows[i][3].ToString();
//Response.Write(arr[i]);
}
myDa.Dispose();
myDs.Dispose();
myConnection.Close();
}
}