protected void Button1_Click(object sender, EventArgs e)
        {
            try
            {
                for (int i = 0; i <= CheckBoxListPage.Items.Count - 1; i++)
                {
                    if (CheckBoxListPage.Items[i].Selected == true)
                    {
                        HiddenFieldPageID.Value = CheckBoxListPage.Items[i].Value;
                        if (checkAlreadyValue(Convert.ToInt32(CheckBoxListPage.Items[i].Value), Convert.ToInt32(DropDownLisGroupName.SelectedValue)) >= 1)
                        {
                            SqlDataSourceDeletePage.Delete();
                        }
                        SqlDataSourceSave.Insert();
                    }

                    else
                    {
                        HiddenFieldPageID.Value = CheckBoxListPage.Items[i].Value;
                        if (checkAlreadyValue(Convert.ToInt32(CheckBoxListPage.Items[i].Value), Convert.ToInt32(DropDownLisGroupName.SelectedValue)) >= 1)
                        {
                            SqlDataSourceDeletePage.Delete();
                        }
                    }
                }
                GridView1.DataBind();
            }
            catch (Exception ex)
            {
                Response.Write(ex.Message);
            }
        }
Beispiel #2
0
        protected void Button1_Click(object sender, EventArgs e)
        {
            if (gvPGselect.Rows.Count > 0)
            {
                for (int i = 0; i < gvPGselect.Rows.Count; i++)
                {
                    HiddenField hfpid = (HiddenField)gvPGselect.Rows[i].FindControl("HFPID");
                    CheckBox    ch    = (CheckBox)gvPGselect.Rows[i].FindControl("CheckBox1");
                    RadioButton r1    = (RadioButton)gvPGselect.Rows[i].FindControl("RadioButton1");
                    RadioButton r2    = (RadioButton)gvPGselect.Rows[i].FindControl("RadioButton2");
                    RadioButton r3    = (RadioButton)gvPGselect.Rows[i].FindControl("RadioButton3");
                    HiddenFieldPageID.Value = hfpid.Value;
                    if (ch.Checked == true)
                    {
                        if (r1.Checked == true)
                        {
                            HiddenField_Access.Value = "1";
                        }
                        if (r2.Checked == true)
                        {
                            HiddenField_Access.Value = "2";
                        }
                        if (r3.Checked == true)
                        {
                            HiddenField_Access.Value = "3";
                        }
                        SqlDataSourceDeletePage.Delete();
                        SqlDataSourceSave.Insert();
                    }
                    else
                    {
                        SqlDataSourceDeletePage.Delete();
                    }
                }
                GridView1.DataBind();
            }
            string hu = "alertG('Record  Saved');$('#dvAddGroup').dialog('close');";

            ScriptManager.RegisterClientScriptBlock(UpdatePanel1, typeof(UpdatePanel), "jscript", hu, true);



            //try
            //{
            //    for (int i = 0; i <= CheckBoxListPage.Items.Count - 1; i++)
            //    {
            //        if (CheckBoxListPage.Items[i].Selected == true)
            //        {
            //            HiddenFieldPageID.Value = CheckBoxListPage.Items[i].Value;
            //            if (checkAlreadyValue(Convert.ToInt32(CheckBoxListPage.Items[i].Value), Convert.ToInt32(DropDownLisGroupName.SelectedValue)) >= 1)
            //            {
            //                SqlDataSourceDeletePage.Delete();
            //            }
            //            SqlDataSourceSave.Insert();
            //        }

            //        else
            //        {
            //            HiddenFieldPageID.Value = CheckBoxListPage.Items[i].Value;
            //            if (checkAlreadyValue(Convert.ToInt32(CheckBoxListPage.Items[i].Value), Convert.ToInt32(DropDownLisGroupName.SelectedValue)) >= 1)
            //            {
            //                SqlDataSourceDeletePage.Delete();
            //            }
            //        }

            //    }
            //    GridView1.DataBind();
            //}
            //catch (Exception ex)
            //{

            //    Response.Write(ex.Message);
            //}
        }