Exemplo n.º 1
0
    protected void OnItemDataBound(object sender, RepeaterItemEventArgs e)
    {
        if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
        {
            string ide;
            ide = (e.Item.FindControl("hfCustomerId") as HiddenField).Value;

            if (string.IsNullOrWhiteSpace(ide))
            {
                ide = (e.Item.FindControl("hfCustomerId1") as HiddenField).Value;
            }
            Session["ide"] = ide;
            DataTable          ds         = new DataTable();
            DataTable          ds1        = new DataTable();
            Panel              panel1     = e.Item.FindControl("Panel1") as Panel;
            DropDownList       ddl_select = e.Item.FindControl("ddl_select") as DropDownList;
            ListItemCollection collection = new ListItemCollection();

            collection.Add(new ListItem("Select"));

            ds1 = db.GetGrid(Convert.ToInt16(ide));
            if (ds1.Rows[0]["neck"].ToString() == "neck")
            {
                try
                {
                    string name = "neck";
                    string id   = Convert.ToString(ide);
                    ds = db.GetGriddata(name);
                    GridView gvneck = e.Item.FindControl("gvneck") as GridView;
                    gvneck.BorderWidth = 2;
                    gvneck.DataSource  = ds;
                    gvneck.Font.Size   = 8;
                    gvneck.Visible     = false;
                    gvneck.DataBind();
                    collection.Add(new ListItem("Neck"));
                    bindedit(gvneck);
                    ds.Clear();
                }
                catch (Exception ex)
                { }
            }
            if (ds1.Rows[0]["MidBack"].ToString() == "MidBack")
            {
                try
                {
                    string name = "MidBack";
                    string id   = Convert.ToString(ide);
                    ds = db.GetGriddata(name);
                    GridView gvmidback = e.Item.FindControl("gvmidback") as GridView;
                    gvmidback.BorderWidth = 2;
                    gvmidback.DataSource  = ds;
                    gvmidback.Font.Size   = 8;
                    gvmidback.Visible     = false;
                    gvmidback.DataBind();
                    collection.Add(new ListItem("Midback"));
                    bindedit(gvmidback);
                    ds.Clear();
                }
                catch (Exception ex)
                {
                }
            }
            if (ds1.Rows[0]["LowBack"].ToString() == "LowBack")
            {
                try
                {
                    string name = "LowBack";
                    string id   = Convert.ToString(ide);
                    ds = db.GetGriddata(name);
                    GridView gvlowback = e.Item.FindControl("gvlowback") as GridView;
                    gvlowback.BorderWidth = 2;
                    gvlowback.DataSource  = ds;
                    gvlowback.Font.Size   = 8;
                    gvlowback.Visible     = false;
                    gvlowback.DataBind();
                    collection.Add(new ListItem("LowBack"));
                    bindedit(gvlowback);
                    ds.Clear();
                }
                catch (Exception ex)
                { }
            }
            if (ds1.Rows[0]["Shoulder"].ToString() == "Shoulder")
            {
                try
                {
                    string name = "Shoulder";
                    string id   = Convert.ToString(ide);
                    ds = db.GetGriddata(name);
                    GridView gvshoulder = e.Item.FindControl("gvshoulder") as GridView;
                    gvshoulder.BorderWidth = 2;
                    gvshoulder.DataSource  = ds;
                    gvshoulder.Font.Size   = 8;
                    gvshoulder.Visible     = false;
                    gvshoulder.DataBind();
                    collection.Add(new ListItem("Shoulder"));
                    bindedit(gvshoulder);
                    ds.Clear();
                }
                catch (Exception ex)
                { }
            }
            if (ds1.Rows[0]["knee"].ToString() == "knee")
            {
                try
                {
                    string name = "knee";
                    string id   = Convert.ToString(ide);
                    ds = db.GetGriddata(name);
                    GridView gvknee = e.Item.FindControl("gvknee") as GridView;
                    gvknee.BorderWidth = 2;
                    gvknee.DataSource  = ds;
                    gvknee.Font.Size   = 8;
                    gvknee.Visible     = false;
                    gvknee.DataBind();
                    collection.Add(new ListItem("knee"));
                    bindedit(gvknee);
                    ds.Clear();
                }
                catch (Exception ex)
                { }
            }
            if (ds1.Rows[0]["elbow"].ToString() == "elbow")
            {
                try
                {
                    string name = "elbow";
                    string id   = Convert.ToString(ide);
                    ds = db.GetGriddata(name);
                    GridView gvelbow = e.Item.FindControl("gvelbow") as GridView;
                    gvelbow.BorderWidth = 2;
                    gvelbow.DataSource  = ds;
                    gvelbow.Font.Size   = 8;
                    gvelbow.DataBind();
                    gvelbow.Visible = false;
                    collection.Add(new ListItem("elbow"));
                    bindedit(gvelbow);
                    ds.Clear();
                }
                catch (Exception ex)
                { }
            }
            if (ds1.Rows[0]["wrist"].ToString() == "wrist")
            {
                try
                {
                    string name = "wrist";
                    string id   = Convert.ToString(ide);
                    ds = db.GetGriddata(name);
                    GridView gvwrist = e.Item.FindControl("gvwrist") as GridView;
                    gvwrist.BorderWidth = 2;
                    gvwrist.DataSource  = ds;
                    gvwrist.Font.Size   = 8;
                    gvwrist.Visible     = false;
                    gvwrist.DataBind();
                    collection.Add(new ListItem("wrist"));
                    bindedit(gvwrist);
                    ds.Clear();
                }
                catch (Exception ex)
                { }
            }
            if (ds1.Rows[0]["hip"].ToString() == "hip")
            {
                try
                {
                    string name = "hip";
                    string id   = Convert.ToString(ide);
                    ds = db.GetGriddata(name);
                    GridView gvhip = e.Item.FindControl("gvhip") as GridView;
                    gvhip.BorderWidth = 2;
                    gvhip.DataSource  = ds;
                    gvhip.Font.Size   = 8;
                    gvhip.Visible     = false;
                    gvhip.DataBind();
                    collection.Add(new ListItem("hip"));
                    bindedit(gvhip);
                    ds.Clear();
                }
                catch (Exception ex)
                { }
            }
            if (ds1.Rows[0]["ankle"].ToString() == "ankle")
            {
                try
                {
                    string name = "ankle";
                    string id   = Convert.ToString(ide);
                    ds = db.GetGriddata(name);
                    GridView gvankle = e.Item.FindControl("gvankle") as GridView;
                    gvankle.BorderWidth = 2;
                    gvankle.DataSource  = ds;
                    gvankle.Font.Size   = 8;
                    gvankle.Visible     = false;
                    gvankle.DataBind();
                    collection.Add(new ListItem("ankle"));
                    bindedit(gvankle);
                    ds.Clear();
                }
                catch (Exception ex)
                { }
            }
            ddl_select.DataSource = collection;
            ddl_select.DataBind();
        }
    }