Click here to Skip to main content
15,888,100 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I am binding the all database tables to the dropdownlist.when i select one table from the dropdownlist want to display the total data of the table.

i am already bind the database tables to the dropdownlist how to get the table data from
dropdown selection table

What I have tried:

using (var Mydb=new MCPEntities())
         {
             FieldInfo[] mytables = Mydb.GetType().GetFields(BindingFlags.Public |BindingFlags.NonPublic |BindingFlags.Instance);
             //List<string> results = Mydb.ExecuteStoreQuery<string>("SELECT name FROM sys.tables ORDER BY name").ToList();


             List<string> tbllistname = new List<string>();
             foreach (var item in mytables)
             {
                 tbllistname.Add(item.Name.Split('<', '>')[1]);
             }
             ViewBag.MyTables = tbllistname;


         }
         return View();
     }
Posted
Updated 1-Sep-17 2:14am
v2
Comments
chandrasekharvsg 1-Sep-17 3:52am    
i am already done in asp.net i want to do in mvc and also not bind to the grid view.i want to bind data to html table
Karthik_Mahalingam 1-Sep-17 5:40am    
however the code is almost same, since most of the part is done with jquery/ajax
Graeme_Grant 1-Sep-17 10:37am    
Post your "ajax part" then. By your own feedback, this is where your bug is, not in the server code.
chandrasekharvsg 4-Sep-17 1:50am    
sorry Grame i didn't use the ajax in my program

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900