gpt4 book ai didi

asp.net - 如何在asp.net中解析 "a control with id X could not be located or a different control is assigned to the same ID after post back"?

转载 作者:行者123 更新时间:2023-12-03 05:34:28 28 4
gpt4 key购买 nike

请帮我纠正这个错误。

An error has occurred because a control with id 'ctl81' could not be located or a different control is assigned to the same ID after post back. If the ID is not assigned, explicitly set the ID property of controls that raise post back events to avoid this error

通过单击 asp 按钮进行回发时发生此错误。页面中的所有控件都是动态生成的。我试图在页面源代码中找到这个控件,但没有成功。

    HtmlGenericControl td1 = new HtmlGenericControl("td");
TextBox txt1 = new TextBox();
txt1.ID = "toqty"+i.Tostring();
td.controls.add(txt1);
placeholder.controls.add(td);

最佳答案

由于错误是由于单击按钮而发生的,因此单击按钮之前生成的控件可能已从相应的表单中清除。因此,我建议您通过在 button_click() 方法上固定断点来检查单击按钮后编写的方法或代码。尝试一下,然后请留下回复。

关于asp.net - 如何在asp.net中解析 "a control with id X could not be located or a different control is assigned to the same ID after post back"?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15410687/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com