简体   繁体   English

单击用户控件1中的按钮可以在aspx.cs类中调用API,但是无法填充用户控件2中的数据

[英]Clicking button in User Control 1 makes API call in aspx.cs class, but fails to populate data in User Control 2

Clicking the "Go" button in my first User Control does everything I want except my second User Control fails to populate the data into the ListView asp control after it receives and binds data to the User Control. 单击我的第一个用户控件中的“执行”按钮,除了我的第二个用户控件在接收数据并将其绑定到该用户控件后,无法将数据填充到ListView asp控件中之外,它需要执行的所有操作。

Odd behavior it also does is cycle (iterate) multiple times through the public EventHandler method I created for it. 它所做的奇怪行为也是通过我为其创建的公共EventHandler方法多次循环(迭代)。 It's totally weird. 太奇怪了

The problem was caused by wrapping a "asp:UpdatePanel" within one of the controls I was using. 问题是由于将“ asp:UpdatePanel”包装在我使用的控件之一中引起的。 The User Control that actually contained the "GO" button_click event. 实际包含“ GO” button_click事件的用户控件。

The solution was to take out the UpdatePanel ASP control and to put it in the aspx (html) page instead and to put the two User Controls I was using inside of the update panel (to make it appear like there is no post-back occurring! Thank you Sathish! :D 解决方案是取出UpdatePanel ASP控件,然后将其放在aspx(html)页面中,然后将我正在使用的两个用户控件放在更新面板中(使它看起来像没有发生回发一样) !谢谢你Sathish!:D

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

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