Asp.net中继器中的控件 [英] controls in Asp.net repeater

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

问题描述

我有一个中继器,它基本上在其中有一个文本框,并且我在中继器上实现了寻呼功能,该中继器一次只显示25行.我想要做的是,在转发器中的每一行都获得每个文本框,但是目前,我仅获得在转发器中显示的文本框(前25行).如何更改我的代码以获取每一行?

我的代码如下:

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. 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). 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;
                            }
                        }
                    }
                }

推荐答案

如果我理解,您有一个包含25个以上项目的数据源,您已将其绑定到一个Repeater,该Repeater会在其中显示25行时间?现在,您想获取第26行及以后的TextBox吗?正确吗?

那样的话,你不能. ASP.NET一次只能呈现25行.阻止此问题的唯一方法是不使用分页并显示数据源中的所有行,因为这可能会很大,从而使页面变慢并给用户带来麻烦.
If I understand, you have a datasource with 25+ items in it which you have bound to a Repeater that will show 25 rows at a time? Now you want to get the TextBox for rows 26 and beyond? Correct?

That being the case, you can''t. ASP.NET will only render 25 rows at a time. The only way to stop this is to not use paging and display all rows in the datasource, which could be very large making the page slow and cumbersome for the user.


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

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