left.ascx.cs
资源名称:yjal.rar [点击查看]
上传用户:shjujing
上传日期:2022-07-28
资源大小:11244k
文件大小:2k
源码类别:
Email客户端
开发平台:
Visual C++
- using System;
- using System.Data;
- using System.Configuration;
- using System.Collections;
- using System.Web;
- using System.Web.Security;
- using System.Web.UI;
- using System.Web.UI.WebControls;
- using System.Web.UI.WebControls.WebParts;
- using System.Web.UI.HtmlControls;
- public partial class left : System.Web.UI.UserControl
- {
- BaseClass bc = new BaseClass();
- protected void Page_Load(object sender, EventArgs e)
- {
- //即时新闻
- dljs.DataSource = bc.GetDataSet("SELECT TOP 30 ID, Style, Title FROM tbNews where issueDate='" + DateTime.Today.ToString() + "'", "tbNews");
- dljs.DataKeyField = "id";
- dljs.DataBind();
- //友情链接
- DataList1.DataSource = bc.GetDataSet("SELECT TOP 5 * FROM tbLink order by addDate desc", "tbLink");
- DataList1.DataKeyField = "id";
- DataList1.DataBind();
- }
- protected void dljs_ItemCommand(object source, DataListCommandEventArgs e)
- {
- string id = dljs.DataKeys[e.Item.ItemIndex].ToString();
- Response.Write("<script language=javascript>window.open('showNews.aspx?id=" + id + "','','width=520,height=260')</script>");
- }
- protected void DataList1_ItemCommand(object source, DataListCommandEventArgs e)
- {
- string strLink="";
- string id = DataList1.DataKeys[e.Item.ItemIndex].ToString();
- DataSet ds = bc.GetDataSet("select * from tbLink where id='"+id+"'","tbLink");
- DataRow[] row=ds.Tables[0].Select();
- foreach(DataRow rs in row)
- {
- strLink = rs["linkAddress"].ToString();
- }
- Response.Write("<script language=javascript>window.open('http://"+strLink+"')</script>");
- }
- protected void Calendar1_SelectionChanged(object sender, EventArgs e)
- {
- Session["changeDate"] = Calendar1.SelectedDate.ToString("yyyy-MM-dd");
- Response.Redirect("index.aspx");
- }
- }