简体   繁体   English

asp.net转发器中的控件

[英]controls in asp.net repeater

I have a repeater, which basically has a text box in it and I have implemented a paging function on the repeater, the repeater only shows 25 rows at a time. 我有一个转发器,它基本上有一个文本框,我在转发器上实现了一个分页功能,转发器一次只显示25行。 What I want to do is, get each text box for each row in the repeater, but at the moment I am only getting the text boxes that are shown on the repeater (the first 25 rows). 我想要做的是,获取转发器中每行的每个文本框,但目前我只获得转发器上显示的文本框(前25行)。 What can I change in my code to get every single row? 我可以在代码中更改以获得每一行?

My code is as follows: 我的代码如下:

foreach (Control control in repeaterSegmentList.Controls)
                {                    
                    foreach (Control innerControl in control.Controls)
                    {
                        if (innerControl.ID != null)
                        {                       

                            if (innerControl.ID == "Priority")
                            {
                                ((TextBox)innerControl).Text = txtPrio.Text;
                            }                           
                        }
                    }
                }

thanks in advance. 提前致谢。

You probably want to get a reference to the datasource that you bound to your repeater. 您可能希望获得对绑定到转发器的数据源的引用。 It's not useful to get references to textboxes that aren't rendered; 获取未呈现的文本框的引用是没有用的; they wouldn't contain anything. 他们不会包含任何东西。

The data that you bind to your control has all the records, the representation of the data on the screen will only have the controls necessary to show the 25 rows in your page. 绑定到控件的数据包含所有记录,屏幕上数据的表示只包含显示页面中25行所需的控件。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM