Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7780491
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T18:54:55+00:00 2026-06-01T18:54:55+00:00

My application is in Asp.net MVC3 coded in C#.Net. I have a view which

  • 0

My application is in Asp.net MVC3 coded in C#.Net.
I have a view which has a DropDownList.This dropdownlist has the Name of all the Tables that are present in my database.
My requirement is when the user selects a particular Table from the Dropdownlist then thru Json im passing the Name of the table to a Json method as is shown in the below Code.

$("#MyTableNames").change(function () {                                         
    $("#MyDiv").load("/../MyController/MyActionMethod", { TableName:$("#MyTableNames").val() }, function () {
    });
});

Above is how im passing my table name to my Action in the controller.
Till here all is fine.
Below is my Action Code.
I have tried Two methods to write a query…It includes the Entity SQL aswell.No LINQ as LINQ doesnt support this.

 //First Method


  public ActionResult MyAction(string TableName)
            {

         var model = db.ExecuteStoreQuery<TableName>("Select * from " + TableName + "      where Delete_Flag='" + false + "'");
ViewBag.MyData=model;
                return PartialView();
            }

//Second Method


    public ActionResult GetRecords(string TableName)
            {
             var sql = "SELECT VALUE emp FROM " + TableName + " AS emp ";
             var query = db.CreateQuery <TableName>(sql);
             Viewbag.MyData=query;       
             return PartialView();
            }

But none of the above methods working as <>want the parameter as the table…
I want to pass the result of the query to the VierwBag so that i can populate it in the View.
Suggest how can i achieve this.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-01T18:54:56+00:00Added an answer on June 1, 2026 at 6:54 pm

    Since you don’t know the type to use during design time, it would be difficult to use strongly typed generics.

    Another approach would be to using ExpandoObject\dynamic with micro ORM frameworks such as Massive to query data. The data returned in this case is a ExpandoObject, which if required can be returned back to client.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

My application is in Asp.Net MVC3 coded in C#.Net. I have Views which contains
This is about asp.net mvc3 web application. We have used Object cache to store
I have a ASP.NET MVC3 application that handles time-consuming processes (copying a large file
I have an asp.net MVC3 application that makes Ajax calls to the server on
I have develop small Asp.net MVC3 application using Telerik rad Controls with in that
I am creating an ASP.NET MVC3 application using NHIBERNATE. I have a base class
I'm working on ASP.net MVC3 Web application that is facing scalability issue. For improving
I'm working on Asp.net MVC3 web application. I'm having one page on which appx.
i'm currently trying to make a asp.net mvc3 app. in the sample application which
We have a ASP.NET MVC 3 application that uses unobtrusive jQuery validation. The page

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.