title: Use different connection string for cascading dropdownlist
body: <p>I have two <code>dropdownlist</code> in my project. My whole project use one <code>connectionstring</code> But for these two dropdownlist, I want to use different <code>connectionstring</code></p>
  
  <p>I have defined all the connectionstring in my <code>web.config</code> file. below is the code:-</p>
  
  <pre><code>&lt;td style="width: 15%" class="field"&gt;
      &lt;select id="cmbRecdDept" runat="server" style="width: 25%" onchange="FunEmpFillDept()"&gt;
          &lt;option value="0"&gt;--Select--&lt;/option&gt;
      &lt;/select&gt;
  &lt;/td&gt;
  &lt;td style="width: 15%" class="field"&gt;
      &lt;select id="cmbRecdEmp" runat="server" style="width: 25%" onchange="FunSelEmpRecd()"&gt;
          &lt;option value="0"&gt;--Select--&lt;/option&gt;
      &lt;/select&gt;
  &lt;/td&gt;
  </code></pre>
  
  <p>and code behind is</p>
  
  <pre><code>ObjPriDT = ObjPriDal.ExecuteDataTable("select distinct master_mkey, Type_Desc from type_mst_a a join emp_mst b on a. master_mkey=b.department_mkey where  b.status in ('A','S','R') order by Type_Desc");
      cmbRecdDept.DataSource = ObjPriDT;
      cmbRecdDept.DataTextField = "Type_Desc";
      cmbRecdDept.DataValueField = "master_mkey";
      cmbRecdDept.DataBind();
      cmbRecdDept.Items.Insert(0, new ListItem("---Select---", "0"));
  </code></pre>
  
  <p>and <code>onchange</code> of first list I bind second list, whose code is below:-</p>
  
  <pre><code>function FunEmpFillDept() {
          document.getElementById('cmbRecdEmp').innerHTML = "";
          var ObjPriOption = document.createElement("Option");
          ObjPriOption.text = "ALL";
          ObjPriOption.value = "0";
          //document.getElementById('txtEmpID').value="0";
          document.getElementById('cmbRecdEmp').add(ObjPriOption);
          StrPriFnName = "FunFillEmp(" + document.getElementById('cmbRecdDept').value + ")";
          var ObjPriXMLHTTP = new ActiveXObject("Microsoft.XMLHTTP");
          ObjPriXMLHTTP.open("GET", "FrmInwardXMLHTTP.aspx?para=" + StrPriFnName, false);
          ObjPriXMLHTTP.send("");
          if (ObjPriXMLHTTP.responseText != "") {
              StrPriRow = ObjPriXMLHTTP.responseText.split('|');
              for (IntPriI = 0; IntPriI &lt; StrPriRow.length - 1; IntPriI++) {
                  StrPriCol = StrPriRow[IntPriI].split('~');
                  var ObjPriOption = document.createElement("Option");
                  ObjPriOption.text = StrPriCol[1];
                  ObjPriOption.value = StrPriCol[0];
                  document.getElementById('cmbRecdEmp').add(ObjPriOption);
              }
          }
      }
  </code></pre>
  
  <p>and its function <code>FunFillEmp</code> is below</p>
  
  <pre><code>public static string FunFillEmp(object[] args)
  {
      string StrPriReturn = "";
      DataAccessLayer ObjPriDt = new DataAccessLayer();
  
      DataTable dt = new DataTable();
      dt = ObjPriDt.ExecuteDataTable("select mkey,Emp_Name,emp_card_no from emp_mst where department_mkey=" + args[0].ToString() + " and status in ('A','S','R') order by 2");
      if (dt.Rows.Count &gt; 0)
      {
          for (int IntpriI = 0; IntpriI &lt; dt.Rows.Count; IntpriI++)
          {
              StrPriReturn += dt.Rows[IntpriI][0].ToString() + "~" + dt.Rows[IntpriI][1].ToString() + "~" + dt.Rows[IntpriI][2].ToString() + "|";
          }
      }
      return StrPriReturn;
  }
  </code></pre>
  
  <p>how to use the different <code>connectionstring</code> for these two dropdownlist</p>
  
  <p><strong>UPDATE</strong></p>
  
  <p>My dataAccesslayer code</p>
  
  <pre><code>public DataAccessLayer(string connectionstring, Providers provider)
  {
      strConnectionString = ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString;
  
      switch (provider)
      {
          case Providers.SqlServer:
              objFactory = SqlClientFactory.Instance;
              break;
          case Providers.OleDb:
              objFactory = OleDbFactory.Instance;
              break;
          case Providers.Oracle:
              objFactory = OracleClientFactory.Instance;
              break;
          case Providers.ODBC:
              objFactory = OdbcFactory.Instance;
              break;
          case Providers.ConfigDefined:
              string providername = ConfigurationManager.ConnectionStrings["ConnectionString"].ProviderName;
              switch (providername)
              {
                  case "System.Data.SqlClient":
                      objFactory = SqlClientFactory.Instance;
                      break;
                  case "System.Data.OleDb":
                      objFactory = OleDbFactory.Instance;
                      break;
                  case "System.Data.OracleClient":
                      objFactory = OracleClientFactory.Instance;
                      break;
                  case "System.Data.Odbc":
                      objFactory = OdbcFactory.Instance;
                      break;
              }
              break;
      }
      objConnection = objFactory.CreateConnection();
      objCommand = objFactory.CreateCommand();
      objConnection.ConnectionString = strConnectionString;
      objCommand.Connection = objConnection;
  }
  </code></pre>