Example #1
0
        protected void DroneBatteryReater_ItemCommand(object source, RepeaterCommandEventArgs e)
        {
            string cmdName = e.CommandName;
            string cmdArgu = e.CommandArgument.ToString();
            string Page    = Request.QueryString["Page"];

            if ("DeleteItem" == cmdName)
            {
                ConnectDB.DeleteBattery(Convert.ToInt32(cmdArgu));
            }

            if ("UpDateItem" == cmdName)
            {
                string targetUrl = "~/Drone_Battery_Create.aspx?Sid=" + cmdArgu;

                Response.Redirect(targetUrl);
            }

            DataTable dt = ConnectDB.ReadDroneBattery();

            if (Page == null)
            {
                Page = "1";
            }

            ChangePage.TotalSize = dt.Rows.Count;
            int fistData = (Convert.ToInt32(Page) - 1) * 10 + 1;
            int LastData = Convert.ToInt32(Page) * 10;

            DataTable dt1 = ConnectDB.ReadTenDataDroneBattery(fistData, LastData);


            this.DroneBatteryReater.DataSource = dt1;
            this.DroneBatteryReater.DataBind();
        }