问题标签 [linqdatasource]
For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.
asp.net - How to programmatically wire up a LINQ dat source in ASP.Net?
myGridView.DataSource = LinqDataSource works but only for select. I have edit and delete columns and when I try to use them I get errors about events not getting caught. Specifically I've seen OnRowDeleting, but I'm sure there are others that need to be wired up.
myGridView.OnRowDeleting = ??
I can't seem to find anything on the LinqDataSource that looks like what I need :(
edit: here is some some sample code illustrating what I'm doing.
Also note that I've statically set the OnRowDeleting event in the markup and the error went away. However, the Linq data source is not getting set back properly. The code is updating it, it's just sticking for whatever reason, so what's happening is that when I re-enable the delete column the data source ends up still being the temp data source I assigned to it (which is just a list), so when I hit delete it was blowing up. Since I've now statically defined the callback, it gets called, but no delete happens because the data source isn't being switched back to the linq data source properly.
so in essence, my issue is that when I dynamically set the data source to the list on the last delete, the change is sticking, but when I dynamically set the data source to the linq data source on the first insert, the change is not sticking. The strangest part of it is that other changes I'm making do stick, just not the data source. I'm enabling the autogenerated edit and delete columns and that change is being reflected immediately.
c# - 在 LinqDataSource 中返回修改后的字段
我有一个LinqDataSource
这样的:
我怎样才能把它转换成这个:
非常感谢您提前。
asp.net - linqdatasource:来自另一个项目的数据绑定
我有一个包含 2 个项目的解决方案“Foo”。“FooCore”和“FooWeb”,其中 FooCore peoject 包含命名空间 Foo.FooCore.Core.Domain 中的 FooDatacontext。如何在 aspx 页面的 FooWeb 项目中将 datacontext 与 linqdatasource 绑定。这可以通过在那个 aspx 页面中执行“<% Import Namespace="Foo.FooCore.Core.Domain"%>" 来实现吗?我希望我能解释我的问题。希望有一个好的简单解决方案。
c# - ASP.NET LinqDataSource WHERE 子句
我需要为我创建一个 WHERE 子句,LinqDataSource
这取决于当前登录的用户。当然,我可以在代码隐藏中访问当前登录的用户,我特别需要用户 ID 从数据库中仅获取属于他/她的数据。
当我将Where
属性添加到<asp:LinqDataSource />
标签时它工作正常,但由于服务器控件中不能有<% %>
标签,我尝试在数据绑定连接到我的数据源的 GridView 之前Where
在代码隐藏中设置属性。OnLoad
但是,在代码隐藏中设置属性时,似乎没有效果。当我在代码中手动(和静态)指定它时,它工作正常ascx
,但不是从代码隐藏。
我猜我在错误的顺序或错误的时间做事。我该怎么做呢?
更新:
想出了这个技巧。我使用一个虚拟标签lblViewedUserID
来Visible="false"
获取一个可以从中提取用户 ID 的控件。我在数据绑定之前从代码隐藏中设置了这个标签的文本。
我还添加<WhereParameters>
了<asp:ControlParameter />
带有一堆属性的。
这真的是您编写 ASP.NET 的方式吗?
gridview - ASP.Net:排序、GridView BoundColumn 与 TemplateColumn
在其他条件相同的情况下,asp:GridView 中的 BoundField 列是可排序的,但 TemplateField 列不是。这是为什么?
单击 BoundField 标头会导致回发并调用我的 Selecting 事件处理程序。它只返回一个 IQueryable,它本身不处理排序。该文档仅说“基础数据源必须支持排序”才能使 GridView 可排序。显然 LinqDataSource 支持排序,否则 BoundField 将无法排序。还是我错过了什么?
devexpress - Devexpress LinqServerModeDataSource 与 LinqDataSource
我需要访问 LinqServerModeDataSource 的返回结果。使用普通 Linqdatasource 时,您可以在“Selected”事件 e.Result 中访问此信息,但 devexpress 对象没有此事件。现在我想起来了,在 devexpress 数据源上没有“ed”事件“更新”,“插入”只有“ing”事件。
任何帮助都会很棒谢谢
asp.net - 如何防止 LinqDataSource Where 子句在回发时重置?
我正在尝试在单击按钮时以编程方式在绑定到 GridView 的 LinqDataSource 对象上设置 where 子句,但是当 GridView 重新绑定数据时(例如,当用户排序时), Where 子句将重置回空字符串。有没有办法防止这种情况,或者有更好的方法来过滤我的结果?
c# - 试图重新排列我的列表视图,但不确定如何获取我需要编辑的属性
因此,我有一个 ListView,其中包含流程中的步骤。左边有一个标签,简单地说明它是哪一步,右边是一个带有说明的文本框。然后在该 TextBox 的右侧是通常的编辑和删除按钮,但我也有一个向上箭头和一个向下箭头。如果单击,我希望将当前的一组项目移动到该插槽中。
此 ListView 由 LinqDataSource 绑定,如果我可以从单击按钮的集合中访问项目的属性,我可以调用 ListView.DataBind() 并且它会自行排序。
我正在谈论的属性是标签中的内容,说明它是哪一步。我的设置是这样的:
所以如果我能做类似的事情
那将是最简单的,但我不知道如何访问此属性。
listview - Asp.net Listview 服务器端分页
我的场景是我将在我的服务器中以 csv 格式上传一些数据,这将有超过 60k 条记录。并且列号可能会更改文件,现在我的问题是我想在列表视图中显示它的内容,并带有分页。而且我不想将整个数据下载到客户端,我希望仅在需要时检索数据。
我如何使用 listview 和 datapager 来做到这一点?我知道 datapager 只支持 linqdatasource 用于服务器端分页?还有其他可能性吗?或对此的建议
提前致谢
linqdatasource - 在 LinqDataSource 上设置 EnabledDelete=true 时,没有为此对象定义无参数构造函数
如果我有一个没有 EnabledDelete、EnabledUpdate、EnabledInsert 的 LinqDataSource,它可以正常工作,但是一旦我将这些属性添加到数据源,我就会收到错误消息:
没有为此对象定义无参数构造函数。