📄 relveantarticle.ascx.cs
字号:
using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
namespace MySite.WebUI.Controls.Tag
{
using SubSonic;
using SubSonic.Generated;
using SubSonic.Sugar;
public partial class RelveantArticle : System.Web.UI.UserControl
{
protected void Page_Load(object sender, EventArgs e)
{
int tagid = Web.QueryString<int>("tagid");
ViewState["tagid"] = tagid;
//if (tagid.HasValue)
//{
// ViewState["tagid"] = tagid.Value;
//}
//else
//{
// ViewState["tagid"] = -1;
//}
//if (!this.IsPostBack)
//{
this.AspNetPager1.RecordCount = _GetCount();
//}
}
private int _GetCount()
{
//return new Select(new string[]{Article.Columns.PKId})
//.From(Article.Schema)
// .Where(Article.Columns.PKId)
// .In(
// new Select(ArticleTagMapping.Columns.ArticleId).From(ArticleTagMapping.Schema)
// .Where(ArticleTagMapping.Columns.TagId).IsEqualTo(Web.QueryString<int>("tagid"))
// )
// .GetRecordCount();
return DB.Select("PKID").From("Articles").Where("PKId").In(new Select("ArticleId").From("ArticleTagMappings")
.Where("tagId").IsEqualTo(ViewState["tagid"])).GetRecordCount();
}
protected void ObjectDataSource1_Selecting(object sender, ObjectDataSourceSelectingEventArgs e)
{
if (!e.ExecutingSelectCount)
{
e.Arguments.StartRowIndex = AspNetPager1.StartRecordIndex;
e.Arguments.MaximumRows = this.AspNetPager1.EndRecordIndex;//AspNetPager1.PageSize;
}
//Query qry = this._BuildQuery();
e.InputParameters["tagId"] = ViewState["tagid"];
}
protected void AspNetPager1_PageChanging(object src, Wuqi.Webdiyer.PageChangingEventArgs e)
{
this.AspNetPager1.CurrentPageIndex = e.NewPageIndex;
this.Repeater1.DataBind();
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -