asp中的省市二级联动

上传人:平*** 文档编号:13272032 上传时间:2017-10-23 格式:DOC 页数:29 大小:162.77KB
返回 下载 相关 举报
asp中的省市二级联动_第1页
第1页 / 共29页
asp中的省市二级联动_第2页
第2页 / 共29页
asp中的省市二级联动_第3页
第3页 / 共29页
asp中的省市二级联动_第4页
第4页 / 共29页
asp中的省市二级联动_第5页
第5页 / 共29页
点击查看更多>>
资源描述

《asp中的省市二级联动》由会员分享,可在线阅读,更多相关《asp中的省市二级联动(29页珍藏版)》请在金锄头文库上搜索。

1、asp中的省市二级联动(2008-11-27 22:26:05)标签:it 分类:aspsql server下的自建表 province(省份),city(城市),如下:省份表 provinceprovince_idprovince_name ProvinceNo ProvinceOrder1 北京市 1 12 上海市 2 23 黑龙江省 3 34 吉林省 4 4城市表 citycity_id city_nameCityNoCityOrder province_id 1 东城区 1 1 12 哈尔滨 2 2 33 佳木斯 3 3 34 黄浦区 4 4 25 长春市 5 5 4联动代码如下: 户

2、籍所在搜索户籍所在地满足条件的用户请选择省份 请选择城市2009-09-09 22:09:40 asp 二级联动同个表 分类:( asp 编程) | 评论:(0) | 浏览:(137) | 标签: 二级联动 同个表数据库结构程序代码id anclassid anclass nclass 0 0 一年级 一年五班1 1 二年级 二年二班2 0 一年级 一年二班3 1 二年级 二年一班4 1 二年级 二年三班5 2 三年级 三年一班6 2 三年级 三年二班7 2 三年级 三年三班var onecount; onecount=0; subcat = new Array(); subcat = new

3、 Array(,); onecount=; function changelocation(locationid) document.form.Nclassid.length = 0; var locationidlocationid=locationid; var i; for (i=0;i Asp.Net DataGrid控件分页代码2008-08-21 18:23先看实现的效果:代码:private int recordCount;public void Page_Load(Object src,EventArgs e)string strComm = select * from new

4、s;string strConnection = Provider=Microsoft.Jet.OleDb.4.0;Data Source=;strConnection += Server.MapPath(app_data/data.mdb);OleDbConnection MyConnection = new OleDbConnection(strConnection);OleDbDataAdapter MyComm = new OleDbDataAdapter(strComm, MyConnection);DataSet MyDataSet = new DataSet();MyComm.F

5、ill(MyDataSet,UserList);recordCount = MyDataSet.Tables0.Rows.Count;DataGrid1.DataSource = MyDataSet.TablesUserList.DefaultView;if(!Page.IsPostBack)DataGrid1.DataBind();pagecount.Text = DataGrid1.PageCount.ToString();nowpage.Text = 1;pagesize.Text = DataGrid1.PageSize.ToString();_recordCount.Text = r

6、ecordCount.ToString();private void change_page(object sender, System.EventArgs e)LinkButton btn = (LinkButton)sender;int PageIndex = Int32.Parse(nowpage.Text) - 1;int _pagecount = Int32.Parse(pagecount.Text);switch(btn.CommandName)case First:PageIndex = 0;break;case Prev:PageIndex = PageIndex - 1;br

7、eak;case Next:PageIndex = PageIndex + 1;break;case Last:PageIndex = _pagecount-1;break;if(PageIndex _pagecount-1) PageIndex = _pagecount-1;DataGrid1.CurrentPageIndex = PageIndex;DataGrid1.DataBind();pagecount.Text = DataGrid1.PageCount.ToString();nowpage.Text = (DataGrid1.CurrentPageIndex + 1).ToStr

8、ing();pagesize.Text = DataGrid1.PageSize.ToString();_recordCount.Text = recordCount.ToString();public void DataGrid1_PageIndexChanged(object sender,DataGridPageChangedEventArgs e) /startIndex = e.NewPageIndex*DataGrid1.PageSize; DataGrid1.CurrentPageIndex=e.NewPageIndex; DataGrid1.DataBind();Asp.Net

9、分页学习首页上一页 下一页尾页第页共页每页条共条DataGrid 自带分页实现2008-08-05 16:45webForm.aspxDataGridPaging首页上一页下一页尾页第页 共页 每页条 共条cs.文件using System;using System.Collections;using System.ComponentModel;using System.Data;using System.Drawing;using System.Web;using System.Web.SessionState;using System.Web.UI;using System.Web.UI.

10、WebControls;using System.Data.SqlClient;using System.Configuration;public partial class PageGridView : System.Web.UI.Pageprivate int recordCount;private int pageCount;protected void Page_Load(object sender, EventArgs e)if (!Page.IsPostBack)DataGridDataBind(); /绑定数据 private void DataGridDataBind()Dat

11、aSet ds = GetCustomersData();recordCount = ds.Tables0.Rows.Count;/获取当前的页数 pageCount = (int)Math.Ceiling(recordCount * 1.0 / PageSize);/避免纪录从有到无时,并且已经进行过反页的情况下CurrentPageIndex PageCount出错 if (recordCount = 0)this.DataGrid1.CurrentPageIndex = 0;else if (this.DataGrid1.CurrentPageIndex = pageCount)this

12、.DataGrid1.CurrentPageIndex = pageCount - 1;this.DataGrid1.DataSource = ds;this.DataGrid1.DataBind();NavigationStateChange();#region Web 窗体设计器生成的代码override protected void OnInit(EventArgs e)/ / CODEGEN: 该调用是 ASP.NET Web 窗体设计器所必需的。 / InitializeComponent();base.OnInit(e);/ / 设计器支持所需的方法 - 不要使用代码编辑器修改/

13、此方法的内容。/ private void InitializeComponent() this.LBtnFirst.Click += new System.EventHandler(this.LBtnNavigation_Click);this.LBtnPrev.Click += new System.EventHandler(this.LBtnNavigation_Click);this.LBtnNext.Click += new System.EventHandler(this.LBtnNavigation_Click);this.LBtnLast.Click += new System

14、.EventHandler(this.LBtnNavigation_Click);this.Load += new System.EventHandler(this.Page_Load);#endregion private void LBtnNavigation_Click(object sender, System.EventArgs e)LinkButton btn = (LinkButton)sender;switch (btn.CommandName)case First:PageIndex = 0;break;case Prev:/if( PageIndex 0 ) PageIndex = PageIndex - 1;break;case Next:/if( PageIndex / 控制导航按钮或数字的状态 / public void NavigationStateChange()if (PageCount intPageCount)intCurrentPageIndex = intPageCo

展开阅读全文
相关资源
正为您匹配相似的精品文档
相关搜索

最新文档


当前位置:首页 > 行业资料 > 其它行业文档

电脑版 |金锄头文库版权所有
经营许可证:蜀ICP备13022795号 | 川公网安备 51140202000112号