示例#1
0
        private void PopupEliminaProfilo_EliminaButtonClicked(object sender, EventArgs e)
        {
            try
            {
                int IDProfilo = Convert.ToInt32(Session["IDProfilo"].ToString());
                AnagraficaDealerService proxyMtd = new AnagraficaDealerService();
                // proxyMtd.DeleteProfilo(IDProfilo);
                string error = proxyMtd.DeleteProfilo(IDProfilo);
                if (error != string.Empty)
                {
                    PopupElimina.Hide();
                    throw new Exception(error);
                }

                Session.Remove("IDProfilo");
                GestioneProfiliSubMenuControl.enableBtnModifica(false);
                GestioneProfiliSubMenuControl.enableBtnElimina(false);

                PopupElimina.Hide();

                profiloGridView.DataSource = proxyMtd.GetAllProfili();
                profiloGridView.DataBind();
                profiliUpdatePanel.Update();
            }
            catch (Exception ex)
            {
                PopupMessaggio.ShowMsgBox(ex.Message, true);
            }
        }
示例#2
0
        protected void cbSelected_CheckedChanged(object sender, EventArgs e)
        {
            CheckBox    chk = (CheckBox)sender;
            GridViewRow gvr = (GridViewRow)chk.NamingContainer;

            int rowIndex = Convert.ToInt32(gvr.DataItemIndex);

            /*Save IDProfilo in session variable*/
            if (chk.Checked)
            {
                int  id;
                bool parsed = Int32.TryParse(profiloGridView.DataKeys[rowIndex].Value.ToString(), out id);

                if (parsed)
                {
                    IDProfilo = id;
                }

                GestioneProfiliSubMenuControl.enableBtnModifica(true);
                GestioneProfiliSubMenuControl.enableBtnElimina(true);
            }
            else
            {
                Session.Remove("IDProfilo");
                GestioneProfiliSubMenuControl.enableBtnModifica(false);
                GestioneProfiliSubMenuControl.enableBtnElimina(false);
            }


            /*Select only one checkbox at time*/
            foreach (GridViewRow row in profiloGridView.Rows)
            {
                CheckBox ChkBoxRows = (CheckBox)row.FindControl("cbSelected");

                if (!chk.Equals(ChkBoxRows))
                {
                    ChkBoxRows.Checked = false;
                }
            }
        }