中继器控制数据 [英] Repeater Control Data

查看:110
本文介绍了中继器控制数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嗨!


我有一个中继器控件在第一列中显示ProductCode,在第1行中显示ProductDescription,在第3行中显示ProductRRP.

我需要遍历此转发器并将条目保存到sql.

如何遍历此转发器并获取值,以便可以将其分配给存储过程参数以进行插入?

谢谢!!

附注-我尝试粘贴一些代码,但代码块"无效.

Hi!


I have a repeater control displays the ProductCode in line1, ProductDescription in Line2 and ProductRRP in Line3 all in one column.

I need to loop through this repeater and save the entries to sql.

How can I loop through this repeater and get the values so that I can assign them to the stored procedure params in order to insert?

Thank you!!

P.S - I tried pasting some code but the "code block" does not work. It removes more than half on the code.

推荐答案

这是ASP.Net中的吗?

如果没有,请忽略其余部分.如果是这样,那么您最好从中继器数据源中获取数据.但是,如果必须从转发器中的控件中读取值,则可以访问实例上的"Items"属性,该属性将包含对所有子控件的引用.

然后,您可以简单地找到所需的控件(可能是Label或Literal)并获取值.

当然,要实现此目的,您的中继器将需要能够通过回发操作来持久存储所需的数据.
Is this in ASP.Net?

If not, ignore the rest of this. If so, then you may be better off taking the data from the repeaters datasource. However, if you must read the values from the controls within the repeater you can access the ''Items'' property on the instance and which will contain a reference to all of the child controls.

You can then simply find the control you want (probably and Label or Literal) and take the value.

Of course, for this to work your repeater will need to be able to persist the data you want through a post back operation.


在ASP.Net中,您可以使用此代码进行迭代直放站物品

In ASP.Net, you can use this code for iterate through Repeater Items

foreach (RepeaterItem item in Repeater1.Items)
{
  // find controls in Repeater and assign values to parameters like

  Label label1 = (Label) item.FindControl("controlname");

  // call the insert function inside the loop.
}


这篇关于中继器控制数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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