public partial class TestingDisplay : System.Web.UI.Page
        {
            PagedDataSource pds = new PagedDataSource();
            protected void Page_Load(object sender, EventArgs e)
            {
                /*SqlConnection conCart;
                SqlCommand cmdSelectCount;



            conCart = new SqlConnection(ConfigurationManager.ConnectionStrings["ConnectionNWind"].ConnectionString);

            conCart.Open();

            cmdSelectCount = new SqlCommand("Select Count(*) From ProductDetails Where CategoryCode = @category", conCart);
            cmdSelectCount.Parameters.AddWithValue("@category", ddlCategory.SelectedItem.Value.ToString());
            var countStart = (Int32)cmdSelectCount.ExecuteScalar();
            lblCount.Text = countStart.ToString();*/

            /*if (!IsPostBack)
            {
                BindGrid();

            } */
        }

        protected void btnSearch_Click(object sender, EventArgs e)
        {
            /*SqlConnection conCart;
            SqlCommand cmdSelectCount;

            conCart = new SqlConnection(ConfigurationManager.ConnectionStrings["ConnectionNWind"].ConnectionString);

            conCart.Open();

            cmdSelectCount = new SqlCommand("Select * From ProductDetails Where CategoryCode = @category", conCart);
            cmdSelectCount.Parameters.AddWithValue("@category", ddlCategory.SelectedItem.Value.ToString());
            cmdSelectCount.ExecuteReader();*/

            String ddlValue;

            ddlValue = ddlCategory.SelectedItem.Value.ToString();

            BindGrid(ddlValue);

        }

        private void BindGrid(String value)
        {

            SqlConnection conProduct;
            conProduct = new SqlConnection(ConfigurationManager.ConnectionStrings["ConnectionNWind"].ConnectionString);
            string conStr = "SELECT ProductID, PName, CategoryCode, Description, SellingPrice, ImageURL FROM ProductDetails Where CategoryCode = @category ";
            SqlDataAdapter da = new SqlDataAdapter(conStr, conProduct);
            da.SelectCommand.Parameters.AddWithValue("@Category", value);
            DataTable dt = new DataTable();
            da.Fill(dt);


            DataList1.DataSource = dt;
            DataList1.DataBind();

            pds.DataSource = dt.DefaultView;
            pds.AllowPaging = true;
            pds.PageSize = 6;
            pds.CurrentPageIndex = CurrentPage;
            lnkbtnNext.Enabled = !pds.IsLastPage;
            lnkbtnPrevious.Enabled = !pds.IsFirstPage;

            DataList1.DataSource = pds;
            DataList1.DataBind();

            doPaging();
        }

        public int CurrentPage
        {

            get
            {
                if (this.ViewState["CurrentPage"] == null)
                    return 0;
                else
                    return Convert.ToInt16(this.ViewState["CurrentPage"].ToString());
            }

            set
            {
                this.ViewState["CurrentPage"] = value;
            }

        }

        private void doPaging()
        {
            DataTable dt = new DataTable();
            dt.Columns.Add("PageIndex");
            dt.Columns.Add("PageText");
            for (int i = 0; i < pds.PageCount; i++)
            {
                DataRow dr = dt.NewRow();
                dr[0] = i;
                dr[1] = i + 1;
                dt.Rows.Add(dr);
            }

            dlPaging.DataSource = dt;
            dlPaging.DataBind();
        }

        protected void dlPaging_ItemCommand(object source, DataListCommandEventArgs e)
        {
            if (e.CommandName.Equals("lnkbtnPaging"))
            {
                CurrentPage = Convert.ToInt16(e.CommandArgument.ToString());
               **BindGrid();**
            }
        }




        protected void lnkbtnNext_Click(object sender, EventArgs e)
        {
            CurrentPage += 1;
            **BindGrid();**
        }

        protected void lnkbtnPrevious_Click(object sender, EventArgs e)
        {
            CurrentPage -= 1;


   ** BindGrid();**


        }

        protected void dlPaging_ItemDataBound(object sender, DataListItemEventArgs e)
        {
            LinkButton lnkbtnPage = (LinkButton)e.Item.FindControl("lnkbtnPaging");
            if (lnkbtnPage.CommandArgument.ToString() == CurrentPage.ToString())
            {
                lnkbtnPage.Enabled = false;
                lnkbtnPage.Font.Bold = true;
            }
        }

    }
}

    public partial class TestingDisplay : System.Web.UI.Page
        {
            PagedDataSource pds = new PagedDataSource();
            protected void Page_Load(object sender, EventArgs e)
            {
                /*SqlConnection conCart;
                SqlCommand cmdSelectCount;

                conCart = new SqlConnection(ConfigurationManager.ConnectionStrings["ConnectionNWind"].ConnectionString);

                conCart.Open();

                cmdSelectCount = new SqlCommand("Select Count(*) From ProductDetails Where CategoryCode = @category", conCart);
                cmdSelectCount.Parameters.AddWithValue("@category", ddlCategory.SelectedItem.Value.ToString());
                var countStart = (Int32)cmdSelectCount.ExecuteScalar();
                lblCount.Text = countStart.ToString();*/

                /*if (!IsPostBack)
                {
                    BindGrid();

                } */
            }

            protected void btnSearch_Click(object sender, EventArgs e)
            {
                /*SqlConnection conCart;
                SqlCommand cmdSelectCount;

                conCart = new SqlConnection(ConfigurationManager.ConnectionStrings["ConnectionNWind"].ConnectionString);

                conCart.Open();

                cmdSelectCount = new SqlCommand("Select * From ProductDetails Where CategoryCode = @category", conCart);
                cmdSelectCount.Parameters.AddWithValue("@category", ddlCategory.SelectedItem.Value.ToString());
                cmdSelectCount.ExecuteReader();*/

                String ddlValue;

                ddlValue = ddlCategory.SelectedItem.Value.ToString();

                BindGrid(ddlValue);

            }

            private void BindGrid(String value)
            {

                SqlConnection conProduct;
                conProduct = new SqlConnection(ConfigurationManager.ConnectionStrings["ConnectionNWind"].ConnectionString);
                string conStr = "SELECT ProductID, PName, CategoryCode, Description, SellingPrice, ImageURL FROM ProductDetails Where CategoryCode = @category ";
                SqlDataAdapter da = new SqlDataAdapter(conStr, conProduct);
                da.SelectCommand.Parameters.AddWithValue("@Category", value);
                DataTable dt = new DataTable();
                da.Fill(dt);


                DataList1.DataSource = dt;
                DataList1.DataBind();

                pds.DataSource = dt.DefaultView;
                pds.AllowPaging = true;
                pds.PageSize = 6;
                pds.CurrentPageIndex = CurrentPage;
                lnkbtnNext.Enabled = !pds.IsLastPage;
                lnkbtnPrevious.Enabled = !pds.IsFirstPage;

                DataList1.DataSource = pds;
                DataList1.DataBind();

                doPaging();
            }

            public int CurrentPage
            {

                get
                {
                    if (this.ViewState["CurrentPage"] == null)
                        return 0;
                    else
                        return Convert.ToInt16(this.ViewState["CurrentPage"].ToString());
                }

                set
                {
                    this.ViewState["CurrentPage"] = value;
                }

            }

            private void doPaging()
            {
                DataTable dt = new DataTable();
                dt.Columns.Add("PageIndex");
                dt.Columns.Add("PageText");
                for (int i = 0; i < pds.PageCount; i++)
                {
                    DataRow dr = dt.NewRow();
                    dr[0] = i;
                    dr[1] = i + 1;
                    dt.Rows.Add(dr);
                }

                dlPaging.DataSource = dt;
                dlPaging.DataBind();
            }

            protected void dlPaging_ItemCommand(object source, DataListCommandEventArgs e)
            {
                if (e.CommandName.Equals("lnkbtnPaging"))
                {
                    CurrentPage = Convert.ToInt16(e.CommandArgument.ToString());
                   BindGrid();
                }
            }




            protected void lnkbtnNext_Click(object sender, EventArgs e)
            {
                CurrentPage += 1;
                BindGrid();
            }

            protected void lnkbtnPrevious_Click(object sender, EventArgs e)
            {
                CurrentPage -= 1;
                BindGrid();
            }

            protected void dlPaging_ItemDataBound(object sender, DataListItemEventArgs e)
            {
                LinkButton lnkbtnPage = (LinkButton)e.Item.FindControl("lnkbtnPaging");
                if (lnkbtnPage.CommandArgument.ToString() == CurrentPage.ToString())
                {
                    lnkbtnPage.Enabled = false;
                    lnkbtnPage.Font.Bold = true;
                }
            }

        }
    }

I have an 3 error with  No overload for method 'BindGrid' takes 0 arguments(BindGrid which shown above with bold text)...how i want to s

olve it?

This error means your calling a method that does not have an option for 0 parameters to be passed to it.

As you decided to be so blunt with your question here is my blunt response:

Go Google how to use BindGrid(), the MSDN will tell you everything you need to know.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.