如何在单击另一行中继器时绑定中继器?
我有一个由来自数据库的数据绑定的转发器。现在,单击其行后,我想绑定另一个详细信息的中继器。还有一点是,两者都不是嵌套的。 好吧,让我用一个例子来解释一下,我有一个复读机。该中继器具有有关学校所有班级的绑定信息。现在我有另一个中继器用于特定班级的详细信息。现在,当我单击班级列表中的特定班级时,我将获得详细信息,即使用绑定第二个中继器班级 ID。
I have a repeater bind by the data coming from database. Now on click of its row i want to bind another repeater of detailed information.One thing more both are not nested.
OK Let me explain with an example, I have a repeater of classes. This repeater has binding information about all classes in school.Now I have another Repeater for detailed information of a particular class.Now when i click on a particular class in list of classes, then i will get the detailed information i.e. bind the second repeater using the class id.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
好吧..所以你知道用户单击的行的特定ID。在单击事件中获取ID并将其传递给你的存储过程或绑定到转发器的任何方式。检查下面的..
以及后面的代码像这样......
试试这个。
Ok..So you know the particular id of row which the user clicks.In the click event get the id and pass it to your stored procedure or what ever way you are binding to the repeater.check this below..
and the code behind goes like this..
Try this out.
我认为这就是您正在寻找的:
显示有关类的扩展信息的用户控件。具有绑定到类实体集合的转发器的 Web 表单。转发器的 ItemTemplate 包含一般类信息的标头和我们创建的 UserControl 实例,其中
Visibility
设置为 false。然后,我们根据用户是否想要查看详细信息来打开/关闭此 UC。一些代码:
实体
ClassDetails
用户控件(aspx)
(代码隐藏)
WebForm
(aspx)
( .cs 文件)
I think this is what you are looking for:
A UserControl that displays extended information about a Class. A web form with a repeater that binds on a collection of Class entities. The ItemTemplate of the repeater consists of a header for general class info and an instance of the UserControl we created with
Visibility
set to false. We then turn this UC on/off depending on whether the user wants to see details.Some code:
Entities
The
ClassDetails
User Control(aspx)
(code-behind)
The WebForm
(aspx)
(.cs file)