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 viewtblKhaterehGroup : System.Web.UI.UserControl
{
    protected void grdFill()
    {
        FirstClass db = new FirstClass();
        DataTable dt = new DataTable();

        dt = db.dbOut(@"SELECT     TOP 100 PERCENT tblKhaterat.NewsID AS nwsID, tblKhaterat.NewsTitle AS nwsTitle, tblKhaterehGroup.NewgGroupDescription AS nwsGroup, 
                      Users.Name + N'  ' + Users.Sname AS Expr1, tblKhaterat.DateOfAdding AS nwsDtadd, tblKhaterat.NewsPic, tblKhaterat.newsBody, 
                      SUBSTRING(tblKhaterat.newsBody, 1, 700) AS NewsPart FROM         tblKhaterat INNER JOIN
                      Users ON tblKhaterat.UserName = Users.UserName INNER JOIN tblKhaterehGroup ON tblKhaterat.NewsGroupID = tblKhaterehGroup.NewsGroupID WHERE     (tblKhaterat.NewsGroupID = '" + int.Parse(Request.QueryString["NewsGroupID"].ToString()) + "') AND (tblKhaterat.ShowPermiss = 1) AND (tblKhaterat.KhaterehTypeID=1) ORDER BY tblKhaterat.NewsID DESC");

        GridView1.DataSource = dt;
        GridView1.EmptyDataText = "هیچگونه نوشتاری درج نشده است. لطفا نوشته های خود را وارد فرمائید.";
        GridView1.DataBind();
    }

    protected void Page_Load(object sender, EventArgs e)
    {
        grdFill();
    }
    protected void GridView1_PageIndexChanging(object sender, GridViewPageEventArgs e)
    {
        GridView1.PageIndex = e.NewPageIndex;
        grdFill();
    }
}
