Asp.net 脚本管理器与按钮冲突
我正在开发一个 asp.net 应用程序,并且有一些在 OnInit 事件上动态创建的控件。
其中一个控件是一个 asp 按钮,到目前为止一直运行良好。当我将 ScriptManager
添加到我的页面时,同一按钮无法回发。仅当取出 ScriptManager
时它才起作用。
类似的事情曾经发生在其他人身上吗?我是否以某种方式使页面无效?
编辑:
这是我的脚本管理器标签:
<asp:ScriptManager ID="ScriptManager1" runat="server"
EnablePageMethods="true" EnableScriptGlobalization="true"
EnableScriptLocalization="true">
</asp:ScriptManager>
//My Dynamic Button:
Button button1 = new Button
{
ID = "button1",
Text = "Ok"
};
button1.Click += new EventHandler(Button1_Click);
好的,一件奇怪的事情。 还没有弄清楚我出现这种行为的原因,但是,如果按钮位于容器内(例如表格单元格),那么它就可以回发。可能是一个解决方法
I'm working on an asp.net app and I have some controls that are created dynamically on the OnInit event.
One of that controls is an asp button that has been working fine until now. When I add a ScriptManager
to my page, that same button is unable to postback. It's only working if a take the ScriptManager
out.
Has anything like this ever appened to somebody else? Am I invalidating the page somehow?
Edit:
This is my script manager tag:
<asp:ScriptManager ID="ScriptManager1" runat="server"
EnablePageMethods="true" EnableScriptGlobalization="true"
EnableScriptLocalization="true">
</asp:ScriptManager>
//My Dynamic Button:
Button button1 = new Button
{
ID = "button1",
Text = "Ok"
};
button1.Click += new EventHandler(Button1_Click);
Ok, one weird thing.
Havent figured it out the reason I'm having this behaviour, but, if the button is inside a container, say, a table cell, then it's able to post back. Might be a workaround
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)