简体   繁体   English

专注于特定的中继器控制项

[英]Focus to a particular repeater control item

I have one update panel inside that one repeater control. 我在那个中继器控件中有一个更新面板。 Again repeater is inside div which has runat='server' property. 同样,转发器位于div内,它具有runat='server'属性。 Which has bound fields like Name - As label Address - As Textbox Comments - As Textbox 其中已绑定字段,例如名称-作为标签地址-作为文本框注释-作为文本框

I have to focus the particular record based on condition.like if name is 'John' i should get focused and scrolled to that record inside repeater.I have written login inside ItemDataBound event of repeater control which has code snippet like - 我必须根据条件集中特定的记录。例如如果名称是``John'',我应该集中精力并滚动到转发器内的该记录。我已经在转发器控件的ItemDataBound事件中编写了登录名,该事件具有代码段,例如-

TextBox txtComments = (TextBox)e.Item.FindControl("txtComments");
txtComments.Focus();

Please suggest any solution it's not working for me. 请提出任何对我不起作用的解决方案。 Thanks!! 谢谢!!

Use this in you page and see if it works 在您的页面中使用它,看看是否可行

Page.MaintainScrollPositionOnPostback = true;

combining you code it becomes 结合你的代码,它成为

TextBox txtComments = (TextBox)e.Item.FindControl("txtComments");
txtComments.Focus();
Page.MaintainScrollPositionOnPostback = true;

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

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