分页数据绑定例子模板
2009-06-22 14:55
369 查看
public void BindData()
{
string FidTemp = Fid.Length < 1 ? ("") : (" and FirstSort='" + Fid + "'");
string SidTemp = Sid.Length < 1 ? ("") : (" and SecSort='" + Sid + "'");
string TidTemp = Tid.Length < 1 ? ("") : (" and [Sort]='" + Tid + "'");
string idKeyWord = this.GetRequest("idKeyWord").Trim();
idKeyWord = idKeyWord.Length>0&&idKeyWord!="请输入关键字"?(" and [CompanyName] like '%"+idKeyWord+"%'"):("");
string idProvince = HttpUtility.UrlDecode(this.GetRequest("idProvince"));
idProvince = idProvince.Length > 0&&idProvince!="不限" ? (" and [Province] = '" + idProvince + "'") : ("");
string idCity = this.GetRequest("idCity");
idCity = idCity.Length > 0 &&idCity!="不限"? (" and [City] = '" + idCity + "'") : ("");
string idArea = this.GetRequest("idArea");
idArea = idArea.Length > 0 &&idArea!="不限"? (" and [Area] ='" + idArea + "'") : ("");
string idCoMode = this.GetRequest("idCoMode");
idCoMode = idCoMode.Length > 0 && idCoMode != "0" ? (" and [DealType] like '%" + (idCoMode == "1" ? ("生产型") : (idCoMode == "2" ? ("贸易型") : (idCoMode == "3" ? ("服务型") : (idCoMode == "4" ? ("政府或其他机构") : (""))))) + "%'") : ("");
string idIsGender = this.GetRequest("idIsGender");
idIsGender = idIsGender == "true" ? (" and [Genderid]=1") : ("");
this.PageSize = 20;
this.Columns = " [domain],[C_ID],[CompanyName],[Introduce],[DealType],[MainProduct],[Province],[City],[Area],case [Genderid] when 0 then '/img/mfree.jpg' when 1 then '/img/mvip.jpg' when 2 then '/img/mvip.jpg' end as Genderid,[Scores],[regTime],[regMoney],[PQQ],[PMSN]";
this.TableName = "V_CompanysList";
this.Where = string.Format(" 1=1{0}{1}{2}{3}{4}{5}{6}{7}{8}", idKeyWord, idProvince, idCity, idArea, idCoMode, idIsGender, FidTemp, SidTemp, TidTemp);
this.Order = "Genderid desc,AddTime desc,C_ID desc";
this.Pid = "C_ID";
this.ResultCount = this.CurrentPage>25?(""):"500";
this.Distinct = "distinct";
this.Pages1.NumCount= Convert.ToInt32(this.Db.GetOne(string.Format("select count(C_ID) from V_CompanysList where {0}", Where)));
this.Pages1.PageSize = this.PageSize;
this.Pages1.CurrentPage = this.CurrentPage;
this.RRpList.DataSource = this.PageData;
this.RRpList.DataBind();
}
{
string FidTemp = Fid.Length < 1 ? ("") : (" and FirstSort='" + Fid + "'");
string SidTemp = Sid.Length < 1 ? ("") : (" and SecSort='" + Sid + "'");
string TidTemp = Tid.Length < 1 ? ("") : (" and [Sort]='" + Tid + "'");
string idKeyWord = this.GetRequest("idKeyWord").Trim();
idKeyWord = idKeyWord.Length>0&&idKeyWord!="请输入关键字"?(" and [CompanyName] like '%"+idKeyWord+"%'"):("");
string idProvince = HttpUtility.UrlDecode(this.GetRequest("idProvince"));
idProvince = idProvince.Length > 0&&idProvince!="不限" ? (" and [Province] = '" + idProvince + "'") : ("");
string idCity = this.GetRequest("idCity");
idCity = idCity.Length > 0 &&idCity!="不限"? (" and [City] = '" + idCity + "'") : ("");
string idArea = this.GetRequest("idArea");
idArea = idArea.Length > 0 &&idArea!="不限"? (" and [Area] ='" + idArea + "'") : ("");
string idCoMode = this.GetRequest("idCoMode");
idCoMode = idCoMode.Length > 0 && idCoMode != "0" ? (" and [DealType] like '%" + (idCoMode == "1" ? ("生产型") : (idCoMode == "2" ? ("贸易型") : (idCoMode == "3" ? ("服务型") : (idCoMode == "4" ? ("政府或其他机构") : (""))))) + "%'") : ("");
string idIsGender = this.GetRequest("idIsGender");
idIsGender = idIsGender == "true" ? (" and [Genderid]=1") : ("");
this.PageSize = 20;
this.Columns = " [domain],[C_ID],[CompanyName],[Introduce],[DealType],[MainProduct],[Province],[City],[Area],case [Genderid] when 0 then '/img/mfree.jpg' when 1 then '/img/mvip.jpg' when 2 then '/img/mvip.jpg' end as Genderid,[Scores],[regTime],[regMoney],[PQQ],[PMSN]";
this.TableName = "V_CompanysList";
this.Where = string.Format(" 1=1{0}{1}{2}{3}{4}{5}{6}{7}{8}", idKeyWord, idProvince, idCity, idArea, idCoMode, idIsGender, FidTemp, SidTemp, TidTemp);
this.Order = "Genderid desc,AddTime desc,C_ID desc";
this.Pid = "C_ID";
this.ResultCount = this.CurrentPage>25?(""):"500";
this.Distinct = "distinct";
this.Pages1.NumCount= Convert.ToInt32(this.Db.GetOne(string.Format("select count(C_ID) from V_CompanysList where {0}", Where)));
this.Pages1.PageSize = this.PageSize;
this.Pages1.CurrentPage = this.CurrentPage;
this.RRpList.DataSource = this.PageData;
this.RRpList.DataBind();
}
相关文章推荐
- 分页数据绑定例子模板
- (原创)动态模板列更新数据分页的例子
- 动态模板列更新数据分页的例子
- REPEATER控件显示数据,交替项显示;分页类的使用,Repeater控件分页;使用DataList控件绑定数据;使用DataList控件的选择模板
- 动态模板列更新数据分页的例子
- 动态模板列更新数据分页的例子
- 动态模板列更新数据分页的例子
- DataGrid动态模板列更新数据并且分页的例子
- GridView 模板列中的数据绑定
- 关于DateList一行绑定多个数据分页(二)aspx文件
- ASP.NET 2.0中实现模板中的数据绑定
- 动态创建模板列并绑定数据(GridView,Repeater,DataGrid)
- Vue.js双向数据绑定模板渲染
- 5.绑定webService数据到DataGrid,设置DataGrid模板,模拟数据库数据的绑定
- Repeater 实现分页、自行绑定数据,对Repeater 进行镶嵌使用
- 腾讯云图片鉴黄集成到C# SQL Server 怎么在分页获取数据的同时获取到总记录数 sqlserver 操作数据表语句模板 .NET MVC后台发送post请求 百度api查询多个地址的经纬度的问题 try{}里有一个 return 语句,那么紧跟在这个 try 后的 finally {}里的 code 会 不会被执行,什么时候被执行,在 return 前还是后? js获取某个日期
- asp.net Oracle数据库左侧目录树及右侧数据绑定及分页
- ASP.NET2.0中给GridView动态添加模板列并自动绑定数据
- 界面对应字段,绑定数据到gridview 显示 及删除功能 窗体事件 分页及键
- Asp.net使用jQuery实现数据绑定与分页