صفحه بندی repeater?

boysilent

New Member
با سلام:
دوستان عزیز یه ریپیتر دارم براش صفحه بندی گذاشتم البته کدشو کپی برداشتم یجاهاییشو تغییر دادم ولی این مشکل رو داره و این خطا رو میده.


کد:
public partial class _Default : System.Web.UI.Page 
{
    private void GetData()
    {

        //----------------------------------------- Part 1

        DataTable dt = new DataTable();

        using (SqlConnection con = new SqlConnection("Data Source=.;Initial Catalog=wordha;Integrated Security=True"))
        {
            SqlCommand cmd = new SqlCommand("select * from wlogin", con);

            SqlDataAdapter da = new SqlDataAdapter(cmd);
            con.Open();

            da.Fill(dt);

            con.Close();
        }

        //----------------------------------------- Part 2

  [COLOR=Red]   [COLOR=Black] PagedDataSource Pd = new PagedDataSource();
[/COLOR][/COLOR]
        Pd.DataSource = dt.DefaultView;
        Pd.AllowPaging = true;
        Pd.CurrentPageIndex = CurrentPage;
        Pd.PageSize = 4;

        Repeater1.DataSource = Pd;
[COLOR=Red] این قسمت خطا میده[/COLOR]      [COLOR=Red]  Repeater1.DataBind();[/COLOR]

        //----------------------------------------- Part 3

        Button4.Enabled = !Pd.IsFirstPage;
        Button5.Enabled = !Pd.IsLastPage;

    }
    public int CurrentPage
    {
        get
        {

            object o = this.ViewState["_CurrentPage"];
            if (o == null)
                return 0;
            else
                return (int)o;
        }

        set
        {
            this.ViewState["_CurrentPage"] = value;
        }
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        {

            if (!IsPostBack)
            {

                GetData();

            }



/////////////////////////////////

 protected void Button4_Click(object sender, EventArgs e)
    {
        CurrentPage += 1;
        GetData();
    }
    protected void Button5_Click(object sender, EventArgs e)
    {
        CurrentPage -= 1;
        GetData();
    }


اینم خطاشه

{"Both DataSource and DataSourceID are defined on 'Repeater1'. Remove one definition."}
 

جدیدترین ارسال ها

بالا