Click here to Skip to main content
15,904,817 members
Home / Discussions / ASP.NET
   

ASP.NET

 
GeneralRe: Sintax problem Pin
Not Active15-Nov-09 16:20
mentorNot Active15-Nov-09 16:20 
GeneralRe: Sintax problem Pin
Christian Graus15-Nov-09 17:26
protectorChristian Graus15-Nov-09 17:26 
GeneralRe: Sintax problem Pin
Maxdd 715-Nov-09 17:31
Maxdd 715-Nov-09 17:31 
GeneralRe: Sintax problem Pin
Not Active15-Nov-09 18:10
mentorNot Active15-Nov-09 18:10 
GeneralRe: Sintax problem Pin
Maxdd 715-Nov-09 18:23
Maxdd 715-Nov-09 18:23 
GeneralRe: Sintax problem Pin
Christian Graus15-Nov-09 19:41
protectorChristian Graus15-Nov-09 19:41 
GeneralRe: Sintax problem Pin
Christian Graus15-Nov-09 19:38
protectorChristian Graus15-Nov-09 19:38 
Questionbinding an arraylist to datalist and implement pagination in Presentation Layer [modified] Pin
uglyeyes15-Nov-09 12:16
uglyeyes15-Nov-09 12:16 
Hi!

I am trying to seperate my PL, BLL and DAL. I have managed successfully bind data to datalist via arraylist. Earlier, I was just doing direct calls to database for pagination using dataset and dataadapter. Since I am binding datalist via arraylist pagination seems bit complicated. below is my code. could someone please help?

 public void ProductList()
            {

                  List<product> products = new List<product>();

                  //DataSet dsProduct = new DataSet();
                  //sqlConn = new SqlConnection(ConfigurationManager.ConnectionStrings["conString"].ConnectionString);
                  //string strSql = string.Format(strSelectSQL, Session["CountryName"], Session["City"], Session["AdType"]);
                  //sqlDataAdapt = new SqlDataAdapter(strSql, sqlConn);
                  if (!Page.IsPostBack)
                  {
                        products = myBLL.Getproducts(Session["CountryName"], Session["City"], Session["AdType"]);
                        //sqlDataAdapt.Fill(dsProduct);
                        //dsproduct = myBLL.Getproducts(Session["CountryName"], Session["City"], Session["AdType"]);
                        lblRecordCount.Text = products.Count.ToString();
                        products = null;
                        List<product> products = new List<product>();
                  }
                  sqlDataAdapt.Fill(dsProduct, Convert.ToInt32(lblCurrentIndex.Text), Convert.ToInt32(lblPageSize.Text), "product");
                  dlproductList.DataSource = dsproduct.Tables["product"].DefaultView;
                  dlproductList.DataBind();
                  sqlConn.Close();
                  ShowCounts();
            }


//DataList Pagination Scripts

            public void ShowFirstPage(System.Object s, System.EventArgs e)
            {
                  lblCurrentIndex.Text = "0";
                  productList();
            }

            public void ShowPreviousPage(System.Object s, System.EventArgs e)
            {

                  lblCurrentIndex.Text = Convert.ToString(Convert.ToInt32(lblCurrentIndex.Text) - Convert.ToInt32(lblPageSize.Text));
                  if (Convert.ToInt32(lblCurrentIndex.Text) < 0)
                  {
                        lblCurrentIndex.Text = "0";
                  }
                  productList();
            }

            public void ShowNextPage(System.Object s, System.EventArgs e)
            {
                  if ((int)Convert.ToInt32(lblCurrentIndex.Text) + Convert.ToInt32(lblPageSize.Text) < Convert.ToInt32(lblRecordCount.Text))
                  {
                        lblCurrentIndex.Text = Convert.ToString(Convert.ToInt32(lblCurrentIndex.Text) + Convert.ToInt32(lblPageSize.Text));
                  }
                  productList();
            }

            public void ShowLastPage(System.Object s, System.EventArgs e)
            {
                  int intMod = 0;
                  intMod = Convert.ToInt32(lblRecordCount.Text) % Convert.ToInt32(lblPageSize.Text);
                  if (intMod > 0)
                  {
                        lblCurrentIndex.Text = Convert.ToString(Convert.ToInt32(lblRecordCount.Text) - intMod);
                  }
                  else
                  {
                        lblCurrentIndex.Text = Convert.ToString(Convert.ToInt32(lblRecordCount.Text) - Convert.ToInt32(lblPageSize.Text));
                  }
                  productList();
            }

            private void ShowCounts()
            {
                  lblCounts.Text = "|Total Rows: <b>" + lblRecordCount.Text;
                  lblCounts.Text += "</b> | Page:<b> ";
                  lblCounts.Text += Convert.ToString(Convert.ToInt32(Convert.ToInt32(lblCurrentIndex.Text) / Convert.ToInt32(lblPageSize.Text)) + 1);
                  lblCounts.Text += "</b> of <b>";
                  if ((Convert.ToInt32(lblRecordCount.Text) % Convert.ToInt32(lblPageSize.Text)) > 0)
                  {
                        lblCounts.Text += Convert.ToString((Convert.ToInt32(lblRecordCount.Text) / Convert.ToInt32(lblPageSize.Text) + 1));
                  }
                  else
                  {
                        lblCounts.Text += Convert.ToString(Convert.ToInt32(lblRecordCount.Text) / Convert.ToInt32(lblPageSize.Text));
                  }
                  lblCounts.Text += "</b> |";
            }


modified on Monday, November 16, 2009 12:05 AM

AnswerRe: binding an arraylist to datalist and implement pagination in Presentation Layer Pin
Abhishek Sur15-Nov-09 12:29
professionalAbhishek Sur15-Nov-09 12:29 
GeneralRe: binding an arraylist to datalist and implement pagination in Presentation Layer Pin
uglyeyes15-Nov-09 13:15
uglyeyes15-Nov-09 13:15 
GeneralRe: binding an arraylist to datalist and implement pagination in Presentation Layer Pin
Abhishek Sur15-Nov-09 21:15
professionalAbhishek Sur15-Nov-09 21:15 
AnswerRe: binding an arraylist to datalist and implement pagination in Presentation Layer Pin
Not Active15-Nov-09 12:32
mentorNot Active15-Nov-09 12:32 
QuestionLogin problem with ExecuteScalar(); Pin
Maxdd 715-Nov-09 11:09
Maxdd 715-Nov-09 11:09 
AnswerRe: Login problem with ExecuteScalar(); Pin
Abhishek Sur15-Nov-09 11:31
professionalAbhishek Sur15-Nov-09 11:31 
GeneralRe: Login problem with ExecuteScalar(); Pin
Not Active15-Nov-09 12:01
mentorNot Active15-Nov-09 12:01 
GeneralRe: Login problem with ExecuteScalar(); Pin
Abhishek Sur15-Nov-09 12:05
professionalAbhishek Sur15-Nov-09 12:05 
GeneralRe: Login problem with ExecuteScalar(); Pin
Not Active15-Nov-09 12:30
mentorNot Active15-Nov-09 12:30 
GeneralRe: Login problem with ExecuteScalar(); Pin
Maxdd 715-Nov-09 12:21
Maxdd 715-Nov-09 12:21 
GeneralRe: Login problem with ExecuteScalar(); Pin
Abhishek Sur15-Nov-09 12:24
professionalAbhishek Sur15-Nov-09 12:24 
GeneralRe: Login problem with ExecuteScalar(); Pin
Not Active15-Nov-09 12:26
mentorNot Active15-Nov-09 12:26 
GeneralRe: Login problem with ExecuteScalar(); Pin
Maxdd 715-Nov-09 12:33
Maxdd 715-Nov-09 12:33 
AnswerRe: Login problem with ExecuteScalar(); Pin
Not Active15-Nov-09 12:04
mentorNot Active15-Nov-09 12:04 
GeneralRe: Login problem with ExecuteScalar(); Pin
Abhishek Sur15-Nov-09 12:08
professionalAbhishek Sur15-Nov-09 12:08 
AnswerRe: Login problem with ExecuteScalar(); Pin
Christian Graus15-Nov-09 17:28
protectorChristian Graus15-Nov-09 17:28 
QuestionAccesing control value in GridView on postback Pin
Aftab Sindhi15-Nov-09 5:07
Aftab Sindhi15-Nov-09 5:07 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.