.net与flash游戏 用.net编程可以操控flash游戏吗? 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 int RecorderCount,PageCount,CurrentPage,PageSize,startindex;//总记录条数,总页数,当前页,每页数量,开始页private void Page_Load(object sender, System.EventArgs e) { PageSize = 10; if(!IsPostBack) { RecorderCount =GetRecorderCount(); rcount.Text = RecorderCount.ToString();//rcount总记录的label PageCount = (RecorderCount-1)/PageSize+1;//计算总页数 pcount.Text = PageCount.ToString();//显示总页数 ViewState["pagecount"] = PageCount; CurrentPage = 0; ViewState["PageIndex"] = CurrentPage; BindList(); } } //RecorderCount计算总记录数 public int GetRecorderCount() { SqlConnection conn = new SqlConnection(ConfigurationSettings.AppSettings["ConnectionString"]); SqlCommand comm = new SqlCommand("select Count(*) from CMRC_Products",conn); conn.Open(); int result =(int)comm.ExecuteScalar(); conn.Close(); return result; } ICollection GreatSource() { SqlConnection conn = new SqlConnection(ConfigurationSettings.AppSettings["ConnectionString"]); SqlCommand comm = new SqlCommand("select * from CMRC_Products",conn); SqlDataAdapter sda = new SqlDataAdapter(comm); startindex = CurrentPage * PageSize;//没页从那里开始索引,也就是说没页从哪条数据开始载入list里面 DataSet ds = new DataSet(); sda.Fill(ds,startindex,PageSize,"porducts"); return ds.Tables["porducts"].DefaultView; } public void BindList() { LinkButtonUp.Enabled = true;//翻页按钮的初始状态 LinkButtonDown.Enabled = true; PageCount =(int)ViewState["pagecount"]; DataListGetProducts.DataSource = GreatSource(); DataListGetProducts.DataBind(); if(CurrentPage ==0) LinkButtonUp.Enabled = false; if(CurrentPage == PageCount-1) LinkButtonDown.Enabled = false; ViewState["PageIndex"] = CurrentPage; cpcount.Text = Convert.ToString(CurrentPage+1); }//回翻 private void LinkButtonUp_Click(object sender, System.EventArgs e) { CurrentPage = (int)ViewState["PageIndex"]; if(CurrentPage > 0) { CurrentPage--; ViewState["PageIndex"] = CurrentPage; } BindList(); } //后翻 private void LinkButtonDown_Click(object sender, System.EventArgs e) { CurrentPage = (int)ViewState["PageIndex"]; PageCount = (int)ViewState["pagecount"]; if(CurrentPage < PageCount) { CurrentPage++; ViewState["PageIndex"] = CurrentPage; } BindList(); } 可以通过.net生成xml来进行通信,其他的不怎么了解 两个项目的整合 程序员不应该有些探索精神吗?今天收到一则骂人的短信! 问下模板 如何将一个二进制的文本转成十进制的字符串?急! 如何获取网页的URL??急 怎么样在后台判断是否爬虫? 各位大哥谁知道这种错误怎么解决啊??? 我做了个菜单控件。基于xml.基本功能完成。 请问怎样控制DataList里的子控件? 求救。头晕了,想不到办法了。 类似 windowsxp缩略图的显示 图片上传出现奇怪问题,分全部送出~!
private void Page_Load(object sender, System.EventArgs e)
{
PageSize = 10; if(!IsPostBack)
{
RecorderCount =GetRecorderCount();
rcount.Text = RecorderCount.ToString();//rcount总记录的label PageCount = (RecorderCount-1)/PageSize+1;//计算总页数
pcount.Text = PageCount.ToString();//显示总页数
ViewState["pagecount"] = PageCount; CurrentPage = 0;
ViewState["PageIndex"] = CurrentPage;
BindList();
}
} //RecorderCount计算总记录数
public int GetRecorderCount()
{
SqlConnection conn = new SqlConnection(ConfigurationSettings.AppSettings["ConnectionString"]);
SqlCommand comm = new SqlCommand("select Count(*) from CMRC_Products",conn);
conn.Open();
int result =(int)comm.ExecuteScalar();
conn.Close();
return result;
}
ICollection GreatSource()
{
SqlConnection conn = new SqlConnection(ConfigurationSettings.AppSettings["ConnectionString"]);
SqlCommand comm = new SqlCommand("select * from CMRC_Products",conn);
SqlDataAdapter sda = new SqlDataAdapter(comm); startindex = CurrentPage * PageSize;//没页从那里开始索引,也就是说没页从哪条数据开始载入list里面 DataSet ds = new DataSet();
sda.Fill(ds,startindex,PageSize,"porducts");
return ds.Tables["porducts"].DefaultView;
}
public void BindList()
{
LinkButtonUp.Enabled = true;//翻页按钮的初始状态
LinkButtonDown.Enabled = true; PageCount =(int)ViewState["pagecount"];
DataListGetProducts.DataSource = GreatSource();
DataListGetProducts.DataBind(); if(CurrentPage ==0) LinkButtonUp.Enabled = false; if(CurrentPage == PageCount-1) LinkButtonDown.Enabled = false; ViewState["PageIndex"] = CurrentPage;
cpcount.Text = Convert.ToString(CurrentPage+1);
}
//回翻
private void LinkButtonUp_Click(object sender, System.EventArgs e)
{
CurrentPage = (int)ViewState["PageIndex"];
if(CurrentPage > 0)
{
CurrentPage--;
ViewState["PageIndex"] = CurrentPage;
}
BindList();
}
//后翻
private void LinkButtonDown_Click(object sender, System.EventArgs e)
{
CurrentPage = (int)ViewState["PageIndex"];
PageCount = (int)ViewState["pagecount"];
if(CurrentPage < PageCount)
{
CurrentPage++;
ViewState["PageIndex"] = CurrentPage;
}
BindList();
}