title: How can i pass asp.net server control type in function?
body: <p>I am writing a function in my class file which connects to the db and loads the data. I want to pass a query, asp.net control type and control id to the function, such that when i call the function , it can load the data based on control type(where i will be writing a switch case for each control type). Some thing like this : </p>
  
  <pre><code>public static string LoadData(string qry, Controltype, controlId)
  {
  
  
  string connstring = "......";
  OleDbDataAdapter da = new OleDbDataAdapter
  DataTable dt = new DataTable();
  OleDbConnection con = new OleDbConnection(connstring);
  con.Open();
  da = new OleDbDataAdapter(qry, connstring);
  dt = new DataTable();
  da.Fill(dt);
  switch(controltype)
  {
   case DropDownList:
        ......
        ......
   break;
  
  case GridView:
        ......
        ......
  break;
  }
  </code></pre>
  
  <p>Can anybody tell me how can i pass Controltype and controlId in this function.</p>