new_user.aspx.cs
资源名称:论坛源码.rar [点击查看]
上传用户:scene123
上传日期:2010-02-19
资源大小:3311k
文件大小:4k
源码类别:
.net编程
开发平台:
C#
- 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.WebControls;
- using System.Web.UI.HtmlControls;
- using System.Data.OleDb;
- using System.Configuration;
- using System.Text;
- namespace kuangren
- {
- /// <summary>
- /// new_user 的摘要说明。
- /// </summary>
- public class new_user : System.Web.UI.Page
- {
- protected int intRunTime;
- protected System.Web.UI.WebControls.Repeater Repeater1;
- protected Wuqi.Webdiyer.AspNetPager AspNetPager1;
- protected Wuqi.Webdiyer.AspNetPager AspNetPager2;
- protected System.Data.OleDb.OleDbCommand cmd;
- protected System.Data.OleDb.OleDbConnection conn;
- protected System.Web.UI.HtmlControls.HtmlForm repeater;
- protected DateTime dtStartTime = DateTime.Now;
- public string showinfor;
- public string usercookies;
- public string judgehomepageerply(object homepage1)
- {
- if ((string)homepage1== "http://")
- return "没有";
- else
- return "<a href="+homepage1+" target=_blank><font color=red>访问</font></a>";
- }
- public string judgeq(object homepage2)
- {
- if ((string)homepage2== "0")
- return "没有";
- else
- return "<a href=http://friend.qq.com/cgi-bin/friend/user_show_info?ln="+homepage2+" target=_blank>"+homepage2+"</a>";
- }
- private void Page_Load(object sender, System.EventArgs e)
- {
- if (Request.Cookies["jusername"]!=null)
- {
- usercookies=Request.Cookies["jusername"].Value;
- }
- else
- {
- Response.Redirect("logine.aspx");
- }
- if (Request.QueryString["user"]=="u_id")
- {showinfor="所有用户列表";}
- else
- { showinfor="发贴总数Top20";}
- conn = new OleDbConnection(ConfigurationSettings.AppSettings["cnFriends.ConnectionString"]);
- if(!Page.IsPostBack)
- {
- cmd=new OleDbCommand("select count(u_id) from userinfo",conn);
- conn.Open();
- AspNetPager1.RecordCount=(int)cmd.ExecuteScalar();
- conn.Close();
- DataBind();
- }
- }
- void DataBind()
- {
- cmd=new OleDbCommand("SELECT * FROM userinfo inner join usergrade on userinfo.u_grade=usergrade.g_id order by "+Request.QueryString["user"]+" desc",conn);
- OleDbDataAdapter adapter=new OleDbDataAdapter(cmd);
- DataSet ds=new DataSet();
- adapter.Fill(ds,AspNetPager1.PageSize*(AspNetPager1.CurrentPageIndex-1),AspNetPager1.PageSize,"userinfo");
- Repeater1.DataSource=ds.Tables["userinfo"];
- Repeater1.DataBind();
- //动态设置用户自定义文本内容
- AspNetPager1.CustomInfoText="记录总数:<b>"+AspNetPager1.RecordCount.ToString()+"</b>";
- AspNetPager1.CustomInfoText+=" 总页数:<b>"+AspNetPager1.PageCount.ToString()+"</b>";
- AspNetPager1.CustomInfoText+=" 当前页:<font color="red"><b>"+AspNetPager1.CurrentPageIndex.ToString()+"</b></font>";
- conn.Close();
- }
- #region Web 窗体设计器生成的代码
- override protected void OnInit(EventArgs e)
- {
- //
- // CODEGEN: 该调用是 ASP.NET Web 窗体设计器所必需的。
- //
- InitializeComponent();
- base.OnInit(e);
- }
- /// <summary>
- /// 设计器支持所需的方法 - 不要使用代码编辑器修改
- /// 此方法的内容。
- /// </summary>
- private void InitializeComponent()
- {
- this.AspNetPager1.PageChanged += new Wuqi.Webdiyer.PageChangedEventHandler(this.AspNetPager1_PageChanged_1);
- this.Load += new System.EventHandler(this.Page_Load);
- }
- #endregion
- private void AspNetPager1_PageChanged_1(object src, Wuqi.Webdiyer.PageChangedEventArgs e)
- {
- AspNetPager1.CurrentPageIndex=e.NewPageIndex;
- DataBind();
- }
- }
- }