问题标签 [repeater]

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.

0 投票
3 回答
6245 浏览

asp.net - ASP.NET:以编程方式设置 HTML 元素的样式

我正在生成一个带有Repeater 控件的菜单,该控件绑定到XmlDataSource。

我希望能够根据鼠标悬停事件和当前选择的菜单项设置包含 LI 的样式。我通过 HtmlGenericControl 尝试过,但我收到一个错误,它是只读的。

有没有办法做到这一点?

0 投票
2 回答
1850 浏览

xml - Flex - databinding from a Tree to a Repeater

I'm trying to make an XML questions editor in flash. Basically I load in the XML into a Tree component - XML like so:

So that goes into the tree. On change I get a list of the options for the selected question (item..option) - and that XMLList is passed into a (custom) component. That component (not sure if this is the best way to go about it but still...) - has a couple of Repeater controls - one which is bound to the XMLList for a radio question, the other bound to the XMLList of a cheque box question. Each repeater loops the number of options, placing a TextInput in (to edit the option text) and either a radio or cheque box (depending on the question type)

So - what I am after is when the text is edited for an option, the XML in that TextInput is bound to the XML which is the dataProvider for the tree. So for example if "This is option 1" is changed to "This is option Foo" - the Tree updates with that.

So far my repeater (eg. for the radios) is like this

No binding works - all I get here is warnings like:

I sort of get why this is the case, but am at a loss how to go about binding the data the user can edit back to the source xml. I know I can make the tree itself editable but that's not really an option here.

So any pointers or ideas would be very appreciated!

0 投票
6 回答
35646 浏览

asp.net - 在ItemDataBound期间如何访问被数据绑定的项目?

我想在 asp:repeater 的 ItemDataBound 事件期间获取正在数据绑定的项目。

我尝试了以下方法(这是stackoverflow 问题中不被接受的答案):

e.Item.DataItem为空。

如何在名为 ItemDataBound 的事件期间访问正在绑定数据的项目。我假设 ItemDataBound 事件发生在项目被数据绑定时。

我想了解对象,以便我可以采取措施控制它的显示方式,此外,该对象可能具有其他有用的属性,可以让我丰富它的显示方式。

回答

工具有正确的答案。答案是e.Item.Data只有在e.Item.ItemType(Item, AlternatingItem) 时才有效。其他时候它是无效的。就我而言,我在没有 DataItem 的页眉(或页脚)行期间收到了 ItemDataBound 事件:

0 投票
2 回答
3940 浏览

c# - 在 .aspx 中,如何将值从 asp:Repeater 传递给代码隐藏函数

因此,我想使用 jquery 来设置按钮的文本,具体取决于中继器当前行中的属性值。

我需要在代码隐藏中调用一个函数来将值映射到按钮应该具有的文本。因此,我需要将转发器中当前项目的 UserStatus 属性的字符串值传递给我的 foo 函数。

我想做以下事情,尽管这种语法显然不正确:

如果代码隐藏包含以下方法定义:

使用转发器中的 Item 值调用 foo 的正确语法是什么?

0 投票
3 回答
199 浏览

c# - 显示器中继器

我需要显示如下内容。

A型

  1. A 类项目 1
  2. 类型 A 项目 2
  3. 类型 A 项目 3

B型

  1. B 型项目 1
  2. B 类项目 2
  3. B 型项目 3

C型

  1. C型项目1
  2. C型项目2
  3. C型项目3

所有数据都来自具有“类型”和“项目名称”列的数据集。现在一个简单的解决方案是为每个“类型”创建一个转发器,并按每个“类型”过滤数据集。但是,我只想使用一个中继器,问题是我需要一些方法来识别每个新部分何时有标题。

因此,只有每个 Type 的第一项获得标题项,所有其他项都设置为空字符串。

有谁知道任何可以帮助的技巧?

0 投票
3 回答
17588 浏览

c# - 从中继器导出到 Excel?

现在我正在使用它来导出一个中继器(具有多个嵌套中继器)到 excel:

但这不是我想要的。相反,它在 excel 文件中给了我 html(尽管数据在那里),这就是我得到的(每行都是 excel 表中的一个单元格):

等等......现在数据是正确的,但我怎样才能让它在电子表格中正确显示?

0 投票
2 回答
3550 浏览

asp.net - ASP.Net:如何使用 DOM/Javascript 向转发器添加行?

我知道 asp.net 转发器没有客户端对象模型,我们一直致力于提高许多具有转发器/网格视图的页面的性能,这些页面具有通过服务器端代码向它们添加行的功能。

我们已经使用更新面板来 ajaxify 将行添加到转发器/网格视图的功能,但是服务器跳闸和在浏览器上渲染所花费的时间是不可接受的。

有什么方法可以在客户端完成,以提高向转发器/网格视图添加行的性能。我们正在使用 Asp.net 2.0

0 投票
1 回答
1899 浏览

javascript - Function to convert GridView and Repeater in a JSON string

I need a JavaScript function which will take the ASP.NET Repeater as input. The function must then parse through the object and return the data in the rows of the object as JSON.

Then, I can send the JSON back to the server to be interpreted/parsed and saved to the DB.

0 投票
2 回答
2099 浏览

c# - inside a repeater control code not showing up in the source code on page render

I have a repeater control where the <%#DataBinder.Eval(Container.DataItem, "Display")%> part doesn't show up. The code that the "Display" stores is set as follows:

After the page load, the audio embed file doesn't show up. The code doesn't even show up in the source. If I add a random string after the ending script tag, that random string will show up.

So, on the page source it will have " THIS IS THE RANDOM STRING" but not the script part.

Does anyone know what is causing this issue and how it can be fixed? Thanks!

Edit: Here is the repeater code:

0 投票
5 回答
21302 浏览

.net - 如何动态刷新 .NET 数据绑定转发器控件

我有一个指向列表的.NET repeater控件。data-bound作为中继器的一部分Item Collection,我有一个“删除按钮”,可以有效地删除这个当前的列表元素。

这有效,在代码隐藏中我可以成功地从Repeaterdatasource中删除一个项目。

我的问题是当我重置更新datasourceMyRepeater.DataBind()再次调用时,Repeater界面不会刷新并删除项目。

我正在寻找基于更新的列表实质上重绘或刷新中继器的事件。感谢您提供任何指示或示例。