通过操作(按钮)在视图中创建通用表 [英] Creating a generic table in view from an action (button)

查看:69
本文介绍了通过操作(按钮)在视图中创建通用表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我对MVC相对较新,并且踢我的屁股!



我的视图上有一个空的dataTable。有一些下拉菜单决定了将要发生的操作。



下拉1 - 从数据库列表中选择

下拉2 - 通过JSON填充,并选择数据库中的表格(来自下拉1)

然后一个按钮。 OnClick它会触发并抓取数据库中的所有数据。



最初它只是一个表,所以我能够使用模型和局部视图。但是现在我可能需要考虑数以千计的表模式,我不知道如何设置它。我从数据库中获取数据并将其推送到控制器中的公共数据表。从那里我试图让它显示到视图,但我唯一的想法是将它推到viewbag。但这样做在返回视图时从不会调用任何东西。



如果可以,请提供帮助。



提前致谢

Samantha

I am relatively new to MVC and its kicking my butt!

I have a view that has an empty dataTable on it. There are a few drop downs that determine the actions that will occur.

Drop down 1 - Selects from a list of databases
Drop down 2 - Populated via JSON with the tables in the db selected (From Drop down 1)
then a button. OnClick it fires and grabs all the data from the database.

Originally it was a single table, so i was able to use a model and a partial view. But now that I have possibly thousands of table schemas to consider, I have no clue how to set it up. I grabbed the data from the database and pushed it to a public data table in my controller. From there i tried getting it to display to the view, but the only thought i had was push it to the viewbag. But doing so never calls anything when it returns back to the view.

please assist if you can.

Thanks in advance
Samantha

推荐答案

这篇关于通过操作(按钮)在视图中创建通用表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆