当DataSource中没有数据时DetailsView不可见
即使底层数据源中没有数据,如何显示DetailsView?
问题是,当 DetailsView 不可见时,命令按钮也不可见。所以我无法将新记录插入数据库。我希望始终可见 DetailsView
并将其 DefaultMode
设置为 ReadOnly。
如果不可能,我想请求解决此问题的方法。
我想到的一种解决方法是检查数据源是否有任何记录。如果否,则以编程方式将 DefaultMode
更改为 Insert。然而这又导致了另一个问题——如何计算DataSource中的记录数。
我所有的问题都与 ASP 3.5 有关
What to do to show DetailsView even when there is no data in underlying datasource?
The problem is that when DetailsView is not visible, the command buttons are also not visible. So I can not insert a new record to a database. I would like to have always visible DetailsView
with its DefaultMode
set to ReadOnly.
If it is not possible I would like to ask for an workaround for this problem.
One workaround which I have on my mind is to check if datasource have any records. If no then programmaticaly change DefaultMode
to Insert. However this causes another problem - how to count the number of records in DataSource.
All my problems are related to the ASP 3.5
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您需要添加一个 EmptyDataTemplate:
You need to add an EmptyDataTemplate: