如题 哪里有省 市 区的联动代码 要客户端的 谢谢 我写了一个 和数据库 交互的 可是客户说每选一个 页面都要闪 一下 比较慢 所以想找一个 不和 数据库交互的 谢谢各位大虾了 在线等
解决方案 »
- repeater嵌套问题
- 请人帮我把这个网站做完了,70%已经OK..还差30%
- 关于获取CheckBox ID值的问题
- asp.net可以做web插件吗?
- 关于IUSE_机器名,aspnet这两个用户权限分配的问题。
- 三层结构的问题。业务逻辑层是什么作用?
- 帮忙!
- 少见的页面后退过期问题
- Response.BinaryWrite((byte[])dt.Rows[0]["RecordCopy"])問題,回答有分
- 简单问题,DataSet的,把两个表的数据放在一个DataSet里面
- 上传图片路径问题,迷茫中
- 求两个正则表达式 一个字符串只有26个字母的验证 还有一个是对于时间类似2005_11_10 这种时间的验证
http://www.cnblogs.com/hchxxzx/archive/2005/07.html
下载地址:61.167.57.121/neccourse/landie/bbf1/djld.rar
如果下载不了,给我发短消息
string numFlag; //操作的标识位
System.Data.DataSet dsT = new DataSet();
//string smsFlag; //手机号
//string nameFlag; //名字
string[] arry = new string[14];
int cboNum;
string groupName;
private System.Windows.Forms.Label lbName;
private System.Windows.Forms.Label lbCity;
private System.Windows.Forms.Label lbAge;
private System.Windows.Forms.Label lbCompany;
private System.Windows.Forms.Label lbPostalcode;
private System.Windows.Forms.ComboBox cboGroup;
private System.Windows.Forms.Label lbGroup;
private System.Windows.Forms.TextBox txtCompany;
private System.Windows.Forms.TextBox txtPostalcode;
private System.Windows.Forms.TextBox txtEmail;
private System.Windows.Forms.TextBox txtAddress;
private System.Windows.Forms.TextBox txtAge;
private System.Windows.Forms.TextBox txtQQ;
private System.Windows.Forms.TextBox txtSMSphone;
private System.Windows.Forms.TextBox txtTelephone;
private System.Windows.Forms.Label lbAddress;
private System.Windows.Forms.StatusBar smsToolBar;
private WiB.Pinkie.Controls.ButtonXP btnOK;
private WiB.Pinkie.Controls.ButtonXP btnClose;
private System.Windows.Forms.GroupBox groupInfo;
private System.Windows.Forms.ComboBox cboProvince;
private System.Windows.Forms.ComboBox cboCity;
private System.Windows.Forms.ComboBox cboSex;
private VolveNet.VolveButton volveButton1;
private System.ComponentModel.IContainer components = null; public InfoForm(string p)
{ numFlag = p;
// 该调用是 Windows 窗体设计器所必需的。
InitializeComponent(); // TODO: 在 InitializeComponent 调用后添加任何初始化
} /// <summary>
/// 清理所有正在使用的资源。
/// </summary>
protected override void Dispose( bool disposing )
{
if( disposing )
{
if (components != null)
{
components.Dispose();
}
}
base.Dispose( disposing );
} #region 设计器生成的代码
/// <summary>
/// 设计器支持所需的方法 - 不要使用代码编辑器修改
/// 此方法的内容。Province
/// </summary>
}
#endregion private void AddForm_Load(object sender, System.EventArgs e)
{
try
{
this.cboSex.SelectedIndex = 0;
this.BindGroupComboBox(); //绑定分组下拉列表
this.BindProvinceComboBox(); //绑定省分组下拉列表
//非添加情况下 (修改以及查看)
if(numFlag.Substring(14,4) != "0x00")
{
//先取省份字段会自动触发 选择连动事件(根据读出的省选择市)
dsT = SQLDataBase.CreateDataSet("select Province from BaseInfo where SMSphone = "+ numFlag.Substring(0,14) +"","BaseInfo");
this.cboProvince.Text = dsT.Tables["BaseInfo"].Rows[0]["Province"].ToString().Trim();
dsT.Dispose();
}
else
{
}
//修改查看时,自动触发和关联省和市(省初始状态为绑定,字段为第一个字段开始)
frmload(); }
catch (Exception ex)
{
MessageBox.Show(ex.Message,"短信系统",MessageBoxButtons.OK,MessageBoxIcon.Information );
}
}
#region 绑定市下拉框,根据省里显示的实现省和市的连动=========================================
private void BindCityComboBox()
{
string strCity = "select CityName from City where ProvinceID = (select ProvinceID from Province where ProvinceName = '"+ this.cboProvince.Text +"')";
dsT = SQLDataBase.CreateDataSet(strCity,"City");
this.cboCity.DataSource = dsT.Tables["City"];
this.cboCity.DisplayMember = "CityName";
dsT.Dispose();
}
#endregion #region 绑定省下拉框=========================================
private void BindProvinceComboBox()
{
dsT = SQLDataBase.CreateDataSet("select ProvinceID,ProvinceName from Province","Province");
this.cboProvince.DataSource = dsT.Tables["Province"];
this.cboProvince.DisplayMember = "ProvinceName";
dsT.Dispose();
}
#endregion #region 绑定分组下拉框=========================================
private void BindGroupComboBox()
{
//全局的DataSet
dsT = SQLDataBase.CreateDataSet("select GroupID,GroupNameID from GroupType","GroupType");
this.cboGroup.DataSource = dsT.Tables["GroupType"];
this.cboGroup.DisplayMember = "GroupID".Trim();
this.dsT.Dispose(); //释放DataSet资源
}
#endregion #region 窗体初始化=========================================
public void frmload()
{
switch(numFlag.Substring(14,4))
{
case "0xFF" : //编辑
this.ShowInfo();
groupInfo.Enabled = true;
break;
case "0xAA" : //详细资料
this.ShowInfo();
this.btnOK.Enabled = false;
groupInfo.Enabled = false;
break;
case "0x00" : //添加
groupInfo.Enabled = true;
break; }
}
#endregion #region 读数据=========================================
private void ShowInfo()
{
dsT = SQLDataBase.CreateDataSet("select * from BaseInfo where SMSphone = '"+ numFlag.Substring(0,14).Trim() +"'","BaseInfo");
this.txtName.Text = dsT.Tables["BaseInfo"].Rows[0]["Name"].ToString();
this.txtTelephone.Text = dsT.Tables["BaseInfo"].Rows[0]["Telephone"].ToString().Trim();
this.txtSMSphone.Text = dsT.Tables["BaseInfo"].Rows[0]["SMSphone"].ToString();
this.txtAge.Text = dsT.Tables["BaseInfo"].Rows[0]["Age"].ToString();
this.txtAddress.Text = dsT.Tables["BaseInfo"].Rows[0]["Address"].ToString();
this.cboCity.Text = dsT.Tables["BaseInfo"].Rows[0]["City"].ToString();
groupName = dsT.Tables["BaseInfo"].Rows[0]["GroupID"].ToString().Trim();//SelectText
this.cboGroup.Text = dsT.Tables["BaseInfo"].Rows[0]["GroupID"].ToString();//SelectText
this.txtQQ.Text = dsT.Tables["BaseInfo"].Rows[0]["Oicq"].ToString();
this.txtEmail.Text = dsT.Tables["BaseInfo"].Rows[0]["Email"].ToString();
this.txtPostalcode.Text = dsT.Tables["BaseInfo"].Rows[0]["Postalcode"].ToString();
this.txtCompany.Text = dsT.Tables["BaseInfo"].Rows[0]["Company"].ToString();
dsT.Dispose();
}
#endregion
private void btnClose_Click(object sender, System.EventArgs e)
{
this.Close();
} private void cboProvince_SelectedIndexChanged(object sender, System.EventArgs e)
{
this.BindCityComboBox();
} private void btnOK_Click(object sender, System.EventArgs e)
{
//确定按钮里设为OK.即 点确定后返回OK
try
{
this.SelectOP();//进行操作
this.cboNum = cboGroup.SelectedIndex;
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}
<HEAD>
<title>testunite</title>
<script language="javascript">
var isCreated;
function lst_change(lValue,lst2ID,arr,NotBack)
{
//alert(lst2ID);
lst2 = document.getElementById(lst2ID);
isCreated = false;
lst2.length = 0;
var a = eval(arr);
j=0;
for (i=0;i<a.length;i++)
{
if (a[i][0] == lValue)
lst2.options[j++] = new Option(a[i][2],a[i][1]);
}
if (lst2.length == 0)
lst2.options[0] = new Option("没有记录","null"); myID = lst2.id;
i = myID.substring(myID.length-1,myID.length);
i = parseInt(i) + 1;
myID = myID.substring(0,myID.length-1);
parentID = myID.split("_")[0];
//var tLst = eval('document.all.'+myID+i);
var tLst = document.getElementById(myID+i);
if (!NotBack)
if (!isCreated)
lstSelected('document.all.'+ myID,parentID);
if (tLst)
{
arrID = arr.substring(0,arr.length-1);
arrID = arrID + i;
//alert(arrID);
lst_change(lst2.value,tLst.id,arrID,NotBack)
}
if (NotBack)
if (!isCreated)
//lstLast_change('document.all.'+ myID,parentID);
lstLast_change(myID,parentID);
}
function lstSelected(clientID,parentID)
{
txtIDs = eval("document.all." + parentID + "_txtValue").value.split('|');
var tmpLst ;
for (L = 2;L<txtIDs.length ;L++)
{
tmpLst = eval(clientID + L);
//alert (tmpLst.options[4].value );
for (j=0;j<tmpLst.length;j++)
if (txtIDs[L-1] == tmpLst.options[j].value)
tmpLst.selectedIndex = j;
}
isCreated = true;
}
function lstLast_change(clientID,parentID)
{
//记录
//var txtID = eval("document.all." + parentID +"_txtValue");
//var txtText = eval("document.all." + parentID +"_txtText");
var txtID = document.getElementById(parentID +"_txtValue");
var txtText = document.getElementById(parentID +"_txtText"); txtID.value = ""; txtText.value = ""; //var tmpLst ;
for (i=1;i<10;i++)
{
//tmpLst = eval(clientID + i);
tmpLst = document.getElementById(clientID + i);
if (tmpLst)
{
txtID.value += tmpLst.value + '|';
txtText.value += tmpLst.options[tmpLst.selectedIndex].text + '|';
//alert(tmpLst.options[0].text);
}
}
isCreated = true;
}
</script>
</HEAD>
<body MS_POSITIONING="FlowLayout">
<form method="post" action="testunite.aspx" id="Form1">
<div></div> <P>
<br>
<span id="Lst2"><input name="Lst2$txtValue" type="text" id="Lst2_txtValue" /><input name="Lst2$txtText" type="text" id="Lst2_txtText" /><select name="Lst2$lst1" id="Lst2_lst1" class="text" onchange="lst_change(this.value,'Lst2_lst2','Lst2arrList2',true)">
<option selected="selected" value="8">软件</option>
<option value="7">耗材</option>
<option value="10306">通讯设备</option>
<option value="10322">存储设备</option>
<option value="5">网络设备</option>
<option value="3">外部设备</option>
<option value="9">数码产品</option>
<option value="2">电脑整机</option>
<option value="1">电脑散件</option></select><select name="Lst2$lst2" id="Lst2_lst2" onchange="lst_change(this.value,'Lst2_lst3','Lst2arrList3',true)">
</select><select name="Lst2$lst3" id="Lst2_lst3" onchange="lstLast_change('Lst2_lst','Lst2')">
</select></span></P>
<script language='javascript'>lst_change('1','Lst1_lst2','Lst1arrList2',true)</script><script language='javascript'>lst_change('8','Lst2_lst2','Lst2arrList2',true)</script></form>
</body>
</HTML>