• 0
ahmedlord2210

كيفية اختيار اكثر من اختيار checkbox

سؤال

السلام عليكم ورحمة الله  انا عمل برنماج ويب ابلكشن وسى شارب هو كيفية عمل اختيار اكثر من checkbox انا عمل حوالة 20 checkbox.checked مطلوب انا عايز اختيار لا يتعدى عن  10 فقط checkbox بشكل عشوائية ثم يقوم بعمل checkbox.enable=false لباقى checkbox 10
وجزاءاك الله كل خير

 

 

post-278789-0-80388100-1390980382_thumb.

0

شارك هذا الرد


رابط المشاركة
شارك الرد من خلال المواقع ادناه

5 إجابة على هذا السؤال .

  • 0
  • 0

شكرا على الرد هو قريب جيدا من انا عاوزها بس المشكلة انا مش عايز جريد فيو بس انا عايز التعامل مع checkbox عادى وجزاءاك الله كل خير

0

شارك هذا الرد


رابط المشاركة
شارك الرد من خلال المواقع ادناه
  • 0

السلام عليكم،

 

كونك لم تعطينا أي فكرة عن الكود لديك، أقترح عليك أن تقوم بعمل ذلك عن طريق جافاسكربت بسيطة، بدلا من كتابتها هنا يرجى الاطلاع على المقال التالي:

http://stackoverflow.com/questions/6303443/grouping-checkboxes-and-allow-checking-a-maximum-of-three-in-each-group

 

أخبرني ان لزمك أي شيء.

 

شكرا...

0

شارك هذا الرد


رابط المشاركة
شارك الرد من خلال المواقع ادناه
  • 0

والله كود هو ذلك
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Data.SqlClient;
using System.Drawing;
public partial class RepService1 : System.Web.UI.Page
{
    public string p_sql;

    protected void Page_Load(object sender, EventArgs e)
    {
        if (!Page.IsPostBack)
        {

            if (Request.Cookies["dcart"] != null)
            {
                HttpCookie myCookie = new HttpCookie("dcart");
                myCookie.Expires = DateTime.Now.AddMilliseconds(-1d);
                myCookie.Path = "/store";
                Response.Cookies.Add(myCookie);
            }
            if (Session["User_Name"].ToString() == "Guest")
            {
                Session["redirect"] = "Statistics";
                Response.Redirect("login.aspx");
            }

            if (Session["dropCenter"].ToString() != "" && Session["dropHosp"].ToString() != "" || Session["Month"].ToString() != "" || Session["year"].ToString() == "")
            {
                string connstring = ConfigurationManager.ConnectionStrings["Statistics"].ToString();
                SqlConnection conn = new SqlConnection(connstring);
                MOHP.NICHP.fillComboBox(dropCent, "select * from  LTDepHosp", conn, "-----");
                MOHP.NICHP.fillComboBox(cmbMonth, "select * from LTMonth", conn, "----");
                MOHP.NICHP.fillComboBox(CmbMonth1, "select * from LTMonth", conn, "----");
                Fillyear();
                Fillyear1();

                Session["dropCenter"] = "";
                Session["dropHosp"] = "";
                Session["month"] = "0";
                Session["year"] = "";


            }
            else
            {
                Response.Redirect("clienc.aspx");
            }

        }


    }


    public void FillCustomers()
    {

        string connstring = ConfigurationManager.ConnectionStrings["Statistics"].ToString();
        SqlConnection conn = new SqlConnection(connstring);
        SqlCommand cmdFilter = new SqlCommand();
        cmdFilter.CommandType = CommandType.StoredProcedure;
        cmdFilter.CommandText = "showHosp";
        cmdFilter.Parameters.AddWithValue("@codDep", int.Parse(dropCent.SelectedValue.ToString()));
        cmdFilter.Connection = conn;
        conn.Open();
        SqlDataAdapter da = new SqlDataAdapter(cmdFilter);
        DataSet ds = new DataSet();
        da.Fill(ds);
        TreeView1.Nodes.Clear();
        foreach (DataRow dr in ds.Tables[0].Rows)
        {

            TreeNode node = new TreeNode();
            node.Text = dr["HospNam"].ToString().Trim();
            node.Value = dr["CodHosp"].ToString().Trim();
            node.PopulateOnDemand = true;
            node.ToolTip = "Click to get Child";
            node.SelectAction = TreeNodeSelectAction.SelectExpand;
            node.CollapseAll();
            TreeView1.Nodes.Add(node);

        }


    }

    private DataSet GetDataSet(string sql)
    {
        //if (sql == null || sql.Length == 0)
        //    return String.Empty;
        string connstring = ConfigurationManager.ConnectionStrings["Statistics"].ToString();
        SqlConnection conn = new SqlConnection(connstring);
        //SqlConnection conn = null;
        try
        {

            SqlDataAdapter da = new SqlDataAdapter(sql, conn);
            DataSet ds = new DataSet();
            da.Fill(ds);
            return ds;
        }
        catch (Exception ex)
        {
            return null;
        }

    }

    protected void TreeView1_TreeNodePopulate(object sender, TreeNodeEventArgs e)
    {
        switch (e.Node.Depth)
        {
            case 0:
                FillCustomers();
                break;

        }
    }

    void showCliencDepHosp()
    {
        string connstring = ConfigurationManager.ConnectionStrings["Statistics"].ToString();
        SqlConnection conn = new SqlConnection(connstring);
        lbldep.Text = dropCent.SelectedItem.Text.ToString();
        lblMon1.Text = cmbMonth.SelectedItem.Text.ToString();
        lblMon2.Text = CmbMonth1.SelectedItem.Text.ToString();
        lblYer1.Text = drpYear.SelectedItem.Text.ToString();
        lblYer2.Text = DropYear1.SelectedItem.Text.ToString();
        conn.Close();

    }


    void selectTree()
    {
        ///ahmed essa please solve code change paramenter multi node change value retarive data datagridview  
        string P_sql1 = "";
        string p_sql3 = "";
        string p_sql4 = "";
        string connstring = ConfigurationManager.ConnectionStrings["Statistics"].ToString();
        SqlConnection conn = new SqlConnection(connstring);
        int x3 = 0;
        if (dropCent.SelectedValue != "-1")
        {
            p_sql3 = "CodDep=" + dropCent.SelectedValue;
        }
        x3 = x3 + 1;
        int x = 0;
        int x5 = 0;
        string str = "";
        ListBox1.Items.Clear();

        foreach (TreeNode node in TreeView1.Nodes)
        {
            if (TreeView1.Nodes[x].Checked == true)
            {
                str = str + "," + TreeView1.Nodes[x].Text;
                ListBox1.Items.Add(TreeView1.Nodes[x].Value);


            }
            x = x + 1;


        }


        int x2 = 0;

        foreach (ListItem node in ListBox1.Items)
        {

            if (x2 == 0)
            {

                p_sql = " AND TScopClienc.CodHosp IN (" + ListBox1.Items[x2].Value + ")";
            }
            else
            {
                if (x2 == 1)
                {
                    p_sql = p_sql.Substring(0, p_sql.Length - 1);
                    p_sql = p_sql + " ," + ListBox1.Items[x2].Value + ")";
                }
                else
                {
                    p_sql = p_sql.Substring(0, p_sql.Length - 1);
                    p_sql = p_sql + " ," + ListBox1.Items[x2].Value + ")";
                }

            }
            x2 = x2 + 1;
        }

        if (cmbMonth.SelectedValue.ToString() != "-1")
        {
            p_sql = p_sql + " AND TScopClienc.MonthID>=" + cmbMonth.SelectedValue.ToString();
        }
        if (CmbMonth1.SelectedValue.ToString() != "-1")
        {
            p_sql = p_sql + " AND TScopClienc.MonthID<=" + CmbMonth1.SelectedValue.ToString();
        }


        //TextBox1.Text = str.ToString();

        P_sql1 = " SELECT SUM(TScopClienc.Stomach_NO) AS 'Stomach_NO', SUM(TScopClienc.Colon_NO) AS 'Colon_NO', SUM(TScopClienc.Channel_No) AS 'Channel_No', " +
                   " SUM(TScopClienc.TelScopBladder) AS 'TelScopBladder', SUM(TScopClienc.TelScopWomb) AS 'TelScopWomb', SUM(TScopClienc.TelScopStomach) AS 'TelScopStomach', SUM(TScopClienc.TotalClienc) AS 'TotalClienc'," +
                     " MAX(TScopClienc.CodDep) AS CodDep, MAX(TScopClienc.CodHosp) AS CodHosp,LTHospt.HospNam, MAX(LtMonth.Month) AS 'Month' ," +
                        " SUM(TScopClienc.Stomach_NO) AS 'totalStomach_NO',SUM(TScopClienc.Colon_NO) AS 'totalColon_NO',SUM(TScopClienc.Channel_No) AS 'totalChannel_No',SUM(TScopClienc.TelScopBladder) AS 'totalTelScopBladder', SUM(TScopClienc.TelScopWomb) AS 'totalTelScopWomb', SUM(TScopClienc.TelScopStomach) AS 'totalTelScopStomach'" +
                          " , SUM(TScopClienc.Stomach_NO+Colon_NO+Channel_No+TelScopBladder+TelScopWomb+TelScopStomach) As 'TotalAll', " +
                           " sum(TCareNatural.Repeate_No) as 'Repeate_No',sum(TCareNatural.Session_No) as 'Session_No',sum(TLabAlk.Pasction_No) as 'Pasction_No',sum(TLabAlk.Anylsis_No) as 'Anylsis_No',sum(TLabAlbul.Pasction_No) AS 'Pasction_No1',sum(TLabAlbul.Anylisis_No) as 'Anylisis_No1',sum(TDepService.Drawing_No) as 'Drawing_No',sum(TDepService.Aran_No) as 'Aran_No',sum(TDepService.PhotoEyes_No) as 'PhotoEyes_No',sum(TDepService.Laser_No) as 'Laser_No',sum(TDepService.Argon_No) as 'Argon_No' ,sum(TDepService.Waveseye) as 'Waveseye' , sum(TDepService.Lenssize) as 'Lenssize',sum(TDepService.Colorphotos) as 'Colorphotos',sum(TDepService.Catching) as 'Catching'  " +

                           " FROM TDepService INNER JOIN LtMonth ON TDepService.MonthId = LtMonth.IDMonth INNER JOIN TScopClienc ON TDepService.CodDep = TScopClienc.CodDep AND TDepService.CodHosp = TScopClienc.CodHosp AND TDepService.MonthId = TScopClienc.MonthId AND TDepService.YearNow = TScopClienc.YearNow AND TDepService.IDService = TScopClienc.IDService INNER JOIN " +
                             " TCareNatural ON TDepService.IDService = TCareNatural.IDService AND TDepService.CodDep = TCareNatural.CodDep AND TDepService.CodHosp = TCareNatural.CodHosp AND TDepService.MonthId = TCareNatural.MonthId AND TDepService.YearNow = TCareNatural.YearNow INNER JOIN TLabAlk ON TDepService.IDService = TLabAlk.IDService AND TDepService.CodDep = TLabAlk.CodDep AND TDepService.CodHosp = TLabAlk.CodHosp AND " +
                                " TDepService.MonthId = TLabAlk.MonthId AND TDepService.YearNow = TLabAlk.YearNow INNER JOIN TLabAlbul ON TDepService.IDService = TLabAlbul.IDService AND TDepService.CodDep = TLabAlbul.CodDep AND TDepService.CodHosp = TLabAlbul.CodHosp AND  TDepService.MonthId = TLabAlbul.MonthId AND TDepService.YearNow = TLabAlbul.YearNow INNER JOIN LTHospt ON TScopClienc.CodDep = LTHospt.CodDep AND TScopClienc.CodHosp = LTHospt.CodHosp " +

                              " WHERE TScopClienc.CodDep =" + dropCent.SelectedValue + p_sql +
                              " and   TScopClienc.YearNow>=" + drpYear.SelectedValue + " and   TScopClienc.YearNow<=" + DropYear1.SelectedValue +
                               " GROUP BY TScopClienc.YearNow, TScopClienc.CodDep, LTHospt.HospNam ";


        SqlCommand cmdfilter = new SqlCommand();

        cmdfilter.CommandType = CommandType.Text;
        cmdfilter.CommandText = P_sql1;
        cmdfilter.Connection = conn;
        conn.Open();
        SqlDataAdapter da = new SqlDataAdapter(cmdfilter);

        DataSet dsFillter = new DataSet();
        da.Fill(dsFillter, P_sql1);
        DataView dvSearch = new DataView((dsFillter.Tables[0]));
        DataTable dt = new DataTable();

        da.Fill(dt);

        grdShowHosp.DataSource = dvSearch;

        grdShowHosp.DataBind();

        conn.Close();

    }

    void RepShowDepService()
    {
        string connstring = ConfigurationManager.ConnectionStrings["Statistics"].ToString();
        SqlConnection conn = new SqlConnection(connstring);
        SqlCommand cmdFilter = new SqlCommand();
        cmdFilter.CommandType = CommandType.StoredProcedure;
        cmdFilter.CommandText = "RepDepService";
        cmdFilter.Parameters.AddWithValue("@codDep", int.Parse(dropCent.SelectedValue.ToString()));
        cmdFilter.Parameters.AddWithValue("@MonthID", int.Parse(cmbMonth.SelectedValue.ToString()));
        cmdFilter.Parameters.AddWithValue("@MonthID1", int.Parse(CmbMonth1.SelectedValue.ToString()));
        cmdFilter.Parameters.AddWithValue("@yearNow", int.Parse(drpYear.SelectedItem.ToString()));
        cmdFilter.Parameters.AddWithValue("@yearNow1", int.Parse(DropYear1.SelectedItem.ToString()));
        cmdFilter.Connection = conn;
        conn.Open();
        SqlDataAdapter da = new SqlDataAdapter(cmdFilter);
        DataSet ds = new DataSet();
        da.Fill(ds);
        grdShowHosp.DataSource = ds;
        grdShowHosp.DataBind();


    }
    protected void BtnSearch_Click(object sender, EventArgs e)
    {
     selectTree();
    }
    protected void BtnEmpty_Click(object sender, EventArgs e)
    {

    }
    protected void dropCent_SelectedIndexChanged1(object sender, EventArgs e)
    {
        FillCustomers();
        showCliencDepHosp();
    }
    protected void cmbMonth_SelectedIndexChanged(object sender, EventArgs e)
    {
        lblMon1.Text = cmbMonth.SelectedItem.Text;
        grdShowHosp.DataSource = "";
        grdShowHosp.DataBind();

    }
    protected void cmbMonth1_SelectedIndexChanged(object sender, EventArgs e)
    {

    }
    protected void drpYear_SelectedIndexChanged(object sender, EventArgs e)
    {
        lblYer1.Text = drpYear.SelectedItem.Text;
        grdShowHosp.DataSource = "";
        grdShowHosp.DataBind();
    }
    void Fillyear()
    {
        try
        {
            for (Int32 i = Convert.ToInt32(DateTime.Now.Year) - 4; i <= Convert.ToInt32(DateTime.Now.Year); i++)
            {
                drpYear.Items.Add(i.ToString());
            }
            drpYear.Items.Insert(0, "SelectYear");
            drpYear.SelectedValue = Convert.ToString(DateTime.Now.Year);
        }
        catch (Exception E)
        {
            Response.Write(E.Message.ToString());
        }


    }
    void Fillyear1()
    {
        try
        {
            for (Int32 i = Convert.ToInt32(DateTime.Now.Year) - 4; i <= Convert.ToInt32(DateTime.Now.Year); i++)
            {
                DropYear1.Items.Add(i.ToString());
            }
            DropYear1.Items.Insert(0, "SelectYear");
            DropYear1.SelectedValue = Convert.ToString(DateTime.Now.Year);
        }
        catch (Exception E)
        {
            Response.Write(E.Message.ToString());
        }


    }

    protected void TreeView1_SelectedNodeChanged1(object sender, EventArgs e)
    {

    }

    protected void TreeNodeEventHandler(object sender, TreeNodeEventArgs e)
    {

    }

    protected void drpyr3_SelectedIndexChanged(object sender, EventArgs e)
    {
        lblMon2.Text = CmbMonth1.SelectedValue.ToString();
        grdShowHosp.DataSource = "";
        grdShowHosp.DataBind();
    }
    protected void ListBox1_SelectedIndexChanged(object sender, EventArgs e)
    {

    }
    protected void CmbMonth1_SelectedIndexChanged(object sender, EventArgs e)
    {
        lblMon2.Text = CmbMonth1.SelectedItem.Text;
        grdShowHosp.DataSource = "";
        grdShowHosp.DataBind();
    }
    protected void DropYear1_SelectedIndexChanged(object sender, EventArgs e)
    {
        lblYer2.Text = DropYear1.SelectedItem.Text;
        grdShowHosp.DataSource = "";
        grdShowHosp.DataBind();

    }

    private double totalStomach_NO = 0;
    private double totalColon_NO = 0;
    private double totalChannel_No = 0;
    private double totalTelScopBladder = 0;
    private double totalTelScopWomb = 0;
    private double totalTelScopStomach = 0;
    private double totalRepeate_No = 0;
    private double totalSession_No = 0;
    private double totalPasction_No = 0;
    private double totalAnylsis_No = 0;
    private double totalPasction_No1 = 0;
    private double totalAnylisis_No1 = 0;
    private double totalPhotoEyes_No = 0;
    private double totalDrawing_No = 0;
    private double totalAran_No = 0;
    private double totalWaveseye = 0;
    private double totalLaser_No = 0;
    private double totalArgon_No = 0;
    private double totalColorphotos = 0;
    private double totalLenssize = 0;
    private double totalCatching = 0;



    private double totalSalary = 0;
    public double GetTotalStomach_NO()
    {
        return totalStomach_NO;
    }

    public double GetTotalColon_NO()
    {
        return totalColon_NO;
    }

    public double GetTotalChannel_No()
    {
        return totalChannel_No;
    }
    public double GetTotalTelScopBladder()
    {
        return totalTelScopBladder;
    }
    public double GetTotalTelScopWomb()
    {
        return totalTelScopWomb;
    }
    public double GetTotalTelScopStomach()
    {
        return totalTelScopStomach;
    }
    public double GetTotalRepeate_No()
    {
        return totalRepeate_No;
    }
    public double GetTotalSession_No()
    {
        return totalSession_No;
    }
    public double GetTotalPasction_No()
    {
        return totalPasction_No;
    }
    public double GetTotalAnylsis_No()
    {
        return totalAnylsis_No;
    }
    public double GetTotalPasction_No1()
    {
        return totalPasction_No1;
    }
    public double GetTotalAnylisis_No1()
    {
        return totalAnylisis_No1;
    }
    public double GetTotalPhotoEyes_No()
    {
        return totalPhotoEyes_No;
    }
    public double GetTotalDrawing_No()
    {
        return totalDrawing_No;

    }
    public double  GetTotalAran_No()
    {
        return totalAran_No;
    }
   public double GetTotalWaveseye()
   {
       return totalWaveseye;
   }
   public double GetTotalLaser_No()
   {
       return totalLaser_No;
   }
  public double GetTotalArgon_No()
  {
      return totalArgon_No;
  }
  public double GetTotalColorphotos()
  {
      return totalColorphotos;
  }
  public double GetTotalLenssize()
  {
      return totalLenssize;
  }
  public double GetTotalCatching()
  {
      return totalCatching;
  }



    public double GetTotalSalary()
    {
        return totalSalary;
    }
    protected void grdShowHosp_RowDataBound(object sender, GridViewRowEventArgs e)
    {
        int totalAll = 0;
        int totalvalue = 0;
        int salary = 0;
        int salary1 = 0;
        int salary2 = 0;
        int salary3 = 0;
        int salary4 = 0;
        int salary5 = 0;
        int salary6 = 0;
        int salary7 = 0;
        int salary8 = 0;
        int salary9 = 0;
        int salary10 = 0;
        int salary11 = 0;
        int salary12 = 0;
        int salary13 = 0;
        int salary14 = 0;
        int salary15 = 0;
        int salary16 = 0;
        int salary17 = 0;
        int salary18 = 0;
        int salary19 = 0;
        int salary20 = 0;

        int tot = 0;
       
        if (e.Row.RowType == DataControlRowType.DataRow || e.Row.RowType == DataControlRowType.Separator)
        {
            e.Row.Cells[0].BackColor = System.Drawing.Color.NavajoWhite;
            e.Row.Cells[7].BackColor = System.Drawing.Color.LightSkyBlue;
            Label lblHosp = (Label)e.Row.FindControl("lblHosp1");
            Label lblStomach_NO = ((Label)e.Row.FindControl("lblStomach_NO"));
            Label lblColon_NO = ((Label)e.Row.FindControl("lblColon_NO"));
            Label lblChannel_No = ((Label)e.Row.FindControl("lblChannel_No"));
            Label lblTelScopBladder = ((Label)e.Row.FindControl("lblTelScopBladder"));
            Label lblTelScopWomb = ((Label)e.Row.FindControl("lblTelScopWomb"));
            Label lblTelScopStomach = ((Label)e.Row.FindControl("lblTelScopStomach"));
            Label piontstotal = ((Label)e.Row.FindControl("lblTotalClienc"));
            Label lblTotalsalary = ((Label)e.Row.FindControl("lblTotalClienc"));
            Label lblRepeat = ((Label)e.Row.FindControl("lblRepeat"));
            Label lblRepeat1 = ((Label)e.Row.FindControl("lblRepeat1"));
            Label lblSession_No = ((Label)e.Row.FindControl("lblSession_No"));
            Label lblSession_No1 = ((Label)e.Row.FindControl("lblSession_No1"));

            Label lblPasction_No = ((Label)e.Row.FindControl("lblPasction_No"));
            Label lblPasction_No11 = ((Label)e.Row.FindControl("lblPasction_No11"));
            Label lblAnylsis_No = ((Label)e.Row.FindControl("lblAnylsis_No"));
            Label lblAnylsis_No11 = ((Label)e.Row.FindControl("lblAnylsis_No11"));

            Label lblPasction_No1 = ((Label)e.Row.FindControl("lblPasction_No1"));
            Label lblPasction_No12 = ((Label)e.Row.FindControl("lblPasction_No12"));
            Label lblAnylisis_No1 = ((Label)e.Row.FindControl("lblAnylisis_No1"));
            Label LblAnylisis_No12 = ((Label)e.Row.FindControl("LblAnylisis_No12"));

            Label lblPhotoEyes_No = ((Label)e.Row.FindControl("lblPhotoEyes_No"));

            Label lblDrawing_No = ((Label)e.Row.FindControl("lblDrawing_No"));
            Label lblAran_No = ((Label)e.Row.FindControl("lblAran_No"));
            Label lblWaveseye = ((Label)e.Row.FindControl("lblWaveseye"));
            Label lblLaser_No = ((Label)e.Row.FindControl("lblLaser_No"));
            Label lblArgon_No = ((Label)e.Row.FindControl("lblArgon_No"));
            Label lblColorphotos = ((Label)e.Row.FindControl("lblColorphotos"));
            Label lblLenssize = ((Label)e.Row.FindControl("lblLenssize"));
            Label lblCatching = ((Label)e.Row.FindControl("lblCatching"));

            lblHosp.Visible = true;
            lblStomach_NO.Visible = false;
            grdShowHosp.Columns[1].Visible = false;
            grdShowHosp.Columns[2].Visible = false;
            grdShowHosp.Columns[3].Visible = false;
            grdShowHosp.Columns[4].Visible = false;
            grdShowHosp.Columns[5].Visible = false;
            grdShowHosp.Columns[6].Visible = false;
            grdShowHosp.Columns[7].Visible = false;
            grdShowHosp.Columns[8].Visible = false;
            grdShowHosp.Columns[9].Visible = false;
            grdShowHosp.Columns[10].Visible = false;
            grdShowHosp.Columns[11].Visible = false;
            grdShowHosp.Columns[12].Visible = false;
            grdShowHosp.Columns[13].Visible = false;
            grdShowHosp.Columns[14].Visible = false;
            grdShowHosp.Columns[15].Visible = false;
            grdShowHosp.Columns[16].Visible = false;
            grdShowHosp.Columns[17].Visible = false;
            grdShowHosp.Columns[18].Visible = false;
            grdShowHosp.Columns[19].Visible = false;
            grdShowHosp.Columns[20].Visible = false;
            //grdShowHosp.Columns[21].Visible = false;
            //grdShowHosp.Columns[22].Visible = false;
            lblRepeat.Visible = false;
           //lblRepeat1.Visible = false;
            lblSession_No.Visible = false;
           //lblSession_No1.Visible = false;
            lblPasction_No.Visible = false;
            lblPasction_No11.Visible = false;

            lblAnylsis_No.Visible = false;
            lblAnylsis_No11.Visible = false;

            lblPasction_No1.Visible = false;
            lblPasction_No12.Visible = false;

            LblAnylisis_No12.Visible = false;
            lblAnylisis_No1.Visible = false;
            lblCatching.Visible = false;
            //grdShowHosp.Columns[9].Visible = false;
            // int.Parse(lblColon_NO.Text.ToString()) + int.Parse(lblChannel_No.Text.ToString()) + int.Parse(lblTelScopBladder.Text.ToString()) + int.Parse(lblTelScopWomb.Text.ToString()) + int.Parse(lblTelScopStomach.Text.ToString());
            DataRowView rowView = (DataRowView)e.Row.DataItem;


            totalSalary += salary;
            if (ChkStomach_NO.Checked)
            {
                lblStomach_NO.Visible = true;
                grdShowHosp.Columns[1].Visible = true;
                totalAll = totalAll + int.Parse(lblStomach_NO.Text.ToString());
                piontstotal.Text = totalAll.ToString();
                grdShowHosp.Columns[7].Visible = true;
                totalvalue = int.Parse(lblStomach_NO.Text.ToString());
                e.Row.Cells[1].Text = totalvalue.ToString();
                salary1 = (int)rowView["TotalStomach_NO"];
                totalStomach_NO += salary1;

            }
            if (ChkColon_NO.Checked)
            {
                grdShowHosp.Columns[2].Visible = true;
                totalAll = totalAll + int.Parse(lblColon_NO.Text.ToString());
                piontstotal.Text = totalAll.ToString();
                grdShowHosp.Columns[7].Visible = true;

                totalvalue = int.Parse(lblColon_NO.Text.ToString());
                e.Row.Cells[2].Text = totalvalue.ToString();
                salary2 = (int)rowView["totalColon_NO"];
                totalColon_NO += salary2;

            }
            if (ChkChannel_No.Checked)
            {
                grdShowHosp.Columns[3].Visible = true;
                totalAll = totalAll + int.Parse(lblChannel_No.Text.ToString());
                e.Row.Cells[7].Text = totalAll.ToString();
                piontstotal.Text = totalAll.ToString();
                grdShowHosp.Columns[7].Visible = true;

                totalvalue = int.Parse(lblChannel_No.Text.ToString());
                e.Row.Cells[3].Text = totalvalue.ToString();
                salary3 = (int)rowView["totalChannel_No"];
                totalChannel_No += salary3;
            }
            if (ChkTelScopBladder.Checked)
            {
                grdShowHosp.Columns[4].Visible = true;
                totalAll = totalAll + int.Parse(lblTelScopBladder.Text.ToString());
                e.Row.Cells[7].Text = totalAll.ToString();
                piontstotal.Text = totalAll.ToString();
                grdShowHosp.Columns[7].Visible = true;

                totalvalue = int.Parse(lblTelScopBladder.Text.ToString());
                e.Row.Cells[4].Text = totalvalue.ToString();
                salary4 = (int)rowView["totalTelScopBladder"];
                totalTelScopBladder += salary4;

            }
            if (ChkTelScopWomb.Checked)
            {
                grdShowHosp.Columns[5].Visible = true;
                totalAll = totalAll + int.Parse(lblTelScopWomb.Text.ToString());
                e.Row.Cells[7].Text = totalAll.ToString();
                piontstotal.Text = totalAll.ToString();
                grdShowHosp.Columns[7].Visible = true;

                totalvalue = int.Parse(lblTelScopWomb.Text.ToString());
                e.Row.Cells[5].Text = totalvalue.ToString();
                salary5 = (int)rowView["totalTelScopWomb"];
                totalTelScopWomb += salary5;
            }
            if (ChkTelScopStomach.Checked)
            {
                grdShowHosp.Columns[6].Visible = true;
                totalAll = totalAll + int.Parse(lblTelScopStomach.Text.ToString());
                e.Row.Cells[7].Text = totalAll.ToString();
                piontstotal.Text = totalAll.ToString();
                grdShowHosp.Columns[7].Visible = true;

                totalvalue = int.Parse(lblTelScopStomach.Text.ToString());
                e.Row.Cells[6].Text = totalvalue.ToString();
                salary5 = (int)rowView["TotalTelScopStomach"];
                totalTelScopStomach += salary5;
            }
            if (ChkRepeate_No.Checked)
            {
                grdShowHosp.Columns[8].Visible = true;
                totalAll = totalAll + int.Parse(lblRepeat.Text.ToString());
                salary6 = (int)rowView["Repeate_No"];
                totalRepeate_No += salary6;
                lblRepeat.Visible = true;
               
            }
            if (ChkSession_No.Checked)
            {
                grdShowHosp.Columns[9].Visible = true;
                totalAll = totalAll + int.Parse(lblSession_No.Text.ToString());
                salary7 = (int)rowView["Session_No"];
                totalSession_No += salary7;
                lblSession_No.Visible = true;
              
            }
            if (ChkPasction_No.Checked)
            {
                grdShowHosp.Columns[10].Visible = true;
                totalAll = totalAll + int.Parse(lblPasction_No.Text.ToString());
                salary8 = (int)rowView["Pasction_No"];
                totalPasction_No += salary8;
                lblPasction_No.Visible = true;
                lblPasction_No11.Visible = true;
            }
            if (ChkAnylsis_No.Checked)
            {
                grdShowHosp.Columns[11].Visible = true;
                totalAll = totalAll + int.Parse(lblAnylsis_No.Text.ToString());
                salary9 = (int)rowView["Anylsis_No"];
                totalAnylsis_No += salary9;

                lblAnylsis_No.Visible = true;
                lblAnylsis_No11.Visible = true;
            }
            if (ChkPasction_No1.Checked)
            {
                grdShowHosp.Columns[12].Visible = true;
                totalAll = totalAll + int.Parse(lblPasction_No1.Text.ToString());
                salary10 = (int)rowView["Pasction_No1"];
                totalPasction_No1 += salary10;

                lblPasction_No12.Visible = true;
                lblPasction_No1.Visible = true;
            }
            if (ChkAnylsis_No1.Checked)
            {
                grdShowHosp.Columns[13].Visible = true;
                totalAll = totalAll + int.Parse(lblAnylisis_No1.Text.ToString());
                salary11 = (int)rowView["Anylisis_No1"];
                totalAnylisis_No1 += salary11;

                LblAnylisis_No12.Visible = true;
                lblAnylisis_No1.Visible = true;
            }
            if (ChkPhotoEyes_No.Checked)
            {
                grdShowHosp.Columns[14].Visible = true;
                totalAll = totalAll + int.Parse(lblPhotoEyes_No.Text.ToString());
                salary12 = (int)rowView["PhotoEyes_No"];
                totalPhotoEyes_No += salary12;

            }
            if (ChkDrawing_No.Checked)
            {
                grdShowHosp.Columns[15].Visible = true;
                totalAll = totalAll + int.Parse(lblDrawing_No.Text.ToString());
                salary13 = (int)rowView["Drawing_No"];
                totalDrawing_No += salary13;

            }
            if (ChkAran_No.Checked)
            {
                grdShowHosp.Columns[16].Visible = true;
                totalAll = totalAll + int.Parse(lblAran_No.Text.ToString());
                salary14 = (int)rowView["Aran_No"];
                totalAran_No += salary14;
            }
            if (ChkWaveseye.Checked)
            {
                grdShowHosp.Columns[17].Visible = true;
                totalAll = totalAll + int.Parse(lblWaveseye.Text.ToString());
                salary15 = (int)rowView["Waveseye"];
                totalWaveseye += salary15;
            }
            if (ChkLaser_No.Checked)
            {
                grdShowHosp.Columns[18].Visible = true;
                totalAll = totalAll + int.Parse(lblLaser_No.Text.ToString());
                salary16 = (int)rowView["Laser_No"];
                totalLaser_No += salary16;
            }
            if (ChkArgon_No.Checked)
            {
                grdShowHosp.Columns[19].Visible = true;
                totalAll = totalAll + int.Parse(lblArgon_No.Text.ToString());
                salary17 = (int)rowView["Argon_No"];
                totalArgon_No += salary17;
            }
            if (ChkColorphotos.Checked)
            {
                grdShowHosp.Columns[20].Visible = true;
                totalAll = totalAll + int.Parse(lblColorphotos.Text.ToString());
                salary18 = (int)rowView["Colorphotos"];
                totalColorphotos += salary18;
            }
            if (ChkLenssize.Checked)
            {
                grdShowHosp.Columns[21].Visible = true;
                totalAll = totalAll + int.Parse(lblLenssize.Text.ToString());
                salary19 = (int)rowView["Lenssize"];
                totalLenssize += salary19;
            }
            if (ChkCatching.Checked)
            {
                grdShowHosp.Columns[22].Visible = true;
                totalAll = totalAll + int.Parse(lblCatching.Text.ToString());
                salary20 = (int)rowView["Catching"];
                totalCatching += salary20;
            }
            totalSalary += int.Parse(lblTotalsalary.Text.ToString());
        }
    }

    public void checkboxtest()
    {
        int count = 0;
        CheckBox[] chk = new CheckBox[21];

        chk[0] = ChkStomach_NO;
        chk[1] = ChkColon_NO;
        chk[2] = ChkChannel_No;
        chk[3] = ChkTelScopBladder;
        chk[4] = ChkTelScopWomb;
        chk[5] = ChkTelScopStomach;
        chk[6] = ChkRepeate_No;
        chk[7] = ChkSession_No;
        chk[8] = ChkPasction_No;
        chk[9] = ChkAnylsis_No;
        chk[10] = ChkPasction_No1;
        chk[11] = ChkAnylsis_No1;
        chk[12] = ChkPhotoEyes_No;
        chk[13] = ChkDrawing_No;
        chk[14] = ChkAran_No;
        chk[15] = ChkWaveseye;
        chk[16] = ChkLaser_No;
        chk[17] = ChkArgon_No;
        chk[18] = ChkColorphotos;
        chk[19] = ChkLenssize;
        chk[20] = ChkCatching;


        for (int i = 0; i >= 20; i++)
        {

            if (chk.Checked)
            {
                count++;
                chk.Enabled = true;
            }
        }
        for (int i = 0; i >= 20; i++)
        {

            if (count >= 10)
            {
                chk.Enabled = false;
                break;

            }

        }
    }

    protected void ChkLenssize_CheckedChanged(object sender, EventArgs e)
    {
        checkboxtest();
    }
    protected void CheckBox_CheckedChanged(object sender, EventArgs e)
    {

    
 
    }
    protected void ChkStomach_NO_CheckedChanged(object sender, EventArgs e)
    {

        checkboxtest();

    }

    protected void ChkColon_NO_CheckedChanged(object sender, EventArgs e)
    {
        checkboxtest();
    }
    protected void ChkChannel_No_CheckedChanged(object sender, EventArgs e)
    {
        checkboxtest();
    }
    protected void ChkTelScopBladder_CheckedChanged(object sender, EventArgs e)
    {
        checkboxtest();
    }
    protected void ChkTelScopWomb_CheckedChanged(object sender, EventArgs e)
    {
        checkboxtest();
    }
    protected void ChkTelScopStomach_CheckedChanged(object sender, EventArgs e)
    {
        checkboxtest();
    }
    protected void ChkRepeate_No_CheckedChanged(object sender, EventArgs e)
    {
        checkboxtest();
    }
    protected void ChkSession_No_CheckedChanged(object sender, EventArgs e)
    {
        checkboxtest();
    }
    protected void ChkPasction_No_CheckedChanged(object sender, EventArgs e)
    {
        checkboxtest();
    }
    protected void ChkAnylsis_No_CheckedChanged(object sender, EventArgs e)
    {
        checkboxtest();
    }
    protected void ChkPasction_No1_CheckedChanged(object sender, EventArgs e)
    {
        checkboxtest();
    }
    protected void ChkAnylsis_No1_CheckedChanged(object sender, EventArgs e)
    {
        checkboxtest();
    }
    protected void ChkPhotoEyes_No_CheckedChanged(object sender, EventArgs e)
    {
        checkboxtest();
    }
    protected void ChkDrawing_No_CheckedChanged(object sender, EventArgs e)
    {
        checkboxtest();
    }
    protected void ChkAran_No_CheckedChanged(object sender, EventArgs e)
    {
        checkboxtest();
    }
    protected void ChkWaveseye_CheckedChanged(object sender, EventArgs e)
    {
        checkboxtest();
    }
    protected void ChkLaser_No_CheckedChanged(object sender, EventArgs e)
    {
        checkboxtest();
    }
    protected void ChkArgon_No_CheckedChanged(object sender, EventArgs e)
    {
        checkboxtest();
    }
    protected void ChkColorphotos_CheckedChanged(object sender, EventArgs e)
    {
        checkboxtest();
    }
    protected void ChkCatching_CheckedChanged(object sender, EventArgs e)
    {
        checkboxtest();
    }
}

بالنسبة لكود المطلوب تعديل فية هو بالوان الاحمر اى ميثود وتحت كل checkbox بالاستدعى الميثود فقط

0

شارك هذا الرد


رابط المشاركة
شارك الرد من خلال المواقع ادناه
  • 0

يمكنك الاستفادة من تقنية الأجاكس في مشروعك فهي تفيدك جدا بسيطة وسهلة الاستخدام

0

شارك هذا الرد


رابط المشاركة
شارك الرد من خلال المواقع ادناه

من فضلك سجل دخول لتتمكن من التعليق

ستتمكن من اضافه تعليقات بعد التسجيل



سجل دخولك الان

  • يستعرض القسم حالياً   0 members

    لا يوجد أعضاء مسجلين يشاهدون هذه الصفحة .