为什么控件没有传递给从aspx到aspx.cs的button

编程入门 行业动态 更新时间:2024-10-03 04:36:25
本文介绍了为什么控件没有传递给从aspx到aspx.cs的button_Click()事件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我也这样做

I am also do this

<asp:ScriptManager ID="ScriptManager" runat="server"></asp:ScriptManager> <asp:UpdatePanel ID="UpdatePanel1" runat="server"> <ContentTemplate>

< asp:button ID =btn2runat =serverText =Delete Selected onclick =btn2_Click/>

<asp:button ID="btn2" runat="server" Text="Delete Selected" onclick="btn2_Click" />

</ContentTemplate> <Triggers> <asp:PostBackTrigger ControlID="btn2" /> </Triggers> </asp:UpdatePanel>

推荐答案

您好, 请添加属性AutoPostBack =true,然后查看。 Autopostback是一种机制,通过该机制,页面将根据Web控件中的某些事件自动发回服务器。在某些Web控件中,该属性称为自动回发。 如果设置为true,它将在事件发生时将请求发送到服务器控件。 每当我们在任何控件中将autopostback属性设置为true时,框架会自动将少量代码插入到生成的HTML中以实现此功能。 1.)一个名为__doPostBack的Java脚本方法(eventtarget,eventargument) 2.)两个名为__EVENTTARGET的隐藏变量__EVENTARGUMENT 3.)OnChange JavaScript事件到控件 希望这有帮助:) 问候, Praneet Hi, Please add a property AutoPostBack="true" and then check. Autopostback is the mechanism, by which the page will be posted back to the server automatically based on some events in the web controls. In some of the web controls, the property called auto post back. If it is set to true,it will send the request to the server when an event happens in the control. Whenever we set autopostback attribute to true in any of the controls, the framework will automatically insert few code in to the HTML generated to implement this functionality. 1.) A Java script method with name __doPostBack (eventtarget, eventargument) 2.) Two Hidden variables with name __EVENTTARGET and __EVENTARGUMENT 3.) OnChange JavaScript event to the control Hope this helps :) Regards, Praneet

更多推荐

为什么控件没有传递给从aspx到aspx.cs的button

本文发布于:2023-11-03 04:28:47,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1554234.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:控件   aspx   button   cs

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!