protected DataTable GetQulaifyingHeadData(Control pg, DataTable qt, DataTable st)
        {
            // Generate Table From  Head Binded and only update value in respective head and send back
            foreach (Control ctrl in pg.Controls)
            {
                //check for all the TextBox controls on the page and clear them
                if (ctrl.GetType() == typeof(USControls.USTextBox) && ctrl.Parent.Visible == true)
                {
                    USControls.USTextBox utxt = (USControls.USTextBox)ctrl;
                    DataRow dr;

                    if (utxt.IsObtained == utxt.IsTotal == utxt.IsPercentage == false)
                    {
                        dr = qt.Select("HeadId=" + utxt.DBName).First();
                        dr["HeadValue"] = utxt.Text;
                    }
                }
                else if (ctrl.GetType() == typeof(USControls.USDropDownList) && ctrl.Parent.Visible == true)
                {
                    USControls.USDropDownList utxt = (USControls.USDropDownList)ctrl;
                    DataRow dr = qt.Select("HeadId=" + utxt.DBName).First();
                    if (dr != null)
                    {
                        dr["HeadValue"] = utxt.SelectedValue;
                    }
                }
                else if (ctrl.GetType() == typeof(USControls.USBaseDropDownList) && ctrl.Parent.Visible == true)
                {
                    USControls.USBaseDropDownList utxt = (USControls.USBaseDropDownList)ctrl;
                    DataRow dr = qt.Select("HeadId=" + utxt.DBName).First();
                    if (dr != null)
                    {
                        dr["HeadValue"] = utxt.SelectedValue;
                    }
                }
                else if (ctrl.GetType() == typeof(USControls.USRadioButtonList) && ctrl.Parent.Visible == true)
                {
                    USControls.USRadioButtonList utxt = (USControls.USRadioButtonList)ctrl;
                    DataRow dr = qt.Select("HeadId=" + utxt.DBName).First();
                    if (dr != null)
                    {
                        dr["HeadValue"] = utxt.SelectedValue;
                    }
                }
                else if (ctrl.GetType() == typeof(USControls.USCheckBox) && ctrl.Parent.Visible == true)
                {
                    USControls.USCheckBox utxt = (USControls.USCheckBox)ctrl;
                    DataRow dr = qt.Select("HeadId=" + utxt.DBName).First();

                    if (dr != null)
                    {
                        dr["HeadValue"] = utxt.Checked == true ? "True" : "False";
                    }
                }
                qt.AcceptChanges();
                GetQulaifyingHeadData(ctrl, qt, st);
            }
            return(qt);
        }
 protected void USBaseDropDownList1_SelectedIndexChanged(object sender, EventArgs e)
 {
     ViewState["IsSearchFound"] = false;
     USControls.USBaseDropDownList drp = sender as USControls.USBaseDropDownList;
     if (drp.SelectedIndex > 0 && drp.ChildDBName.ToString().ToInt64() > 0)
     {
         String Para1 = drp.SelectedValue.ToString();
         GetSearchDropdownbyDBName(sectionSerach, Para1, drp.ChildDBName);
     }
 }
        protected void GetSearchDropdownbyDBName(Control control, string Para1, string ChildDBName)
        {
            if (ViewState["IsSearchFound"].ToString().ToBoolean() == false)
            {
                foreach (Control ctrl in control.Controls)
                {
                    if (ctrl.GetType() == typeof(USControls.USDropDownList) && ctrl.Parent.Visible == true)
                    {
                        USControls.USDropDownList drp = (USControls.USDropDownList)ctrl.FindControl("USDDTEMP");
                        if (drp.DBName == ChildDBName && drp.DBName != "")
                        {
                            drp.Items.Clear();
                            DataTable dt = BAL.FormFillingmgmt.BindDropDownFromTemplateDropDownIdAndPara1(drp.DBName, Para1).Tables[0];
                            foreach (DataRow drow in dt.Rows)
                            {
                                ListItem lst = new ListItem(drow["ParameterText"].ToString(), drow["ParameterValue"].ToString());
                                drp.Items.Add(lst);
                            }
                            ViewState["IsFound"] = true;
                            return;
                        }
                    }
                    //Sufiyan Adding for UsBase Template filtering  || ctrl.GetType() == typeof(USControls.USBaseDropDownList))
                    else if (ctrl.GetType() == typeof(USControls.USBaseDropDownList) && ctrl.Parent.Visible == true)
                    {
                        USControls.USDropDownList     drp2 = (USControls.USDropDownList)ctrl.FindControl("USDDTEMP");
                        USControls.USBaseDropDownList drp1 = (USControls.USBaseDropDownList)ctrl.FindControl("USBaseDropDownList1");
                        if (drp2.DBName == ChildDBName && drp2.DBName != "")
                        {
                            drp1.Items.Clear();
                            DataTable dt = BAL.FormFillingmgmt.BindDropDownFromTemplateDropDownIdAndPara1(drp2.DBName, Para1).Tables[0];
                            foreach (DataRow drow in dt.Rows)
                            {
                                ListItem lst = new ListItem(drow["ParameterText"].ToString(), drow["ParameterValue"].ToString());
                                drp1.Items.Add(lst);
                            }
                            ViewState["IsFound"] = true;
                            return;
                        }
                    }

                    else if (ViewState["IsFound"].ToString().ToBoolean() == false)
                    {
                        GetDropdownbyDBName(ctrl, Para1, ChildDBName);
                    }
                }
            }
        }