English 中文(简体)
触发的纽顿造成全方位退却
原标题:triggered button cause fullpostback

I ve got an updatePanel and a button which triggered in it. However, the button causes full postback instead of partial one. Here s my Code:

<asp:Button ID="cEvent" runat="server" Text="&#1510;&#1493;&#1512; &#1497;&#1493;&#1501;" Width="80px" 
                    Height="40px" Font-Size="Medium" onclick="cEvent_Click" CausesValidation="false"/>

<asp:ScriptManager ID="ScriptManager1" runat="server"></asp:ScriptManager>
                    <asp:UpdatePanel id = "updatePanel1" runat="server" UpdateMode="Conditional">
                        <Triggers>
                            <asp:AsyncPostBackTrigger ControlID="cEvent" EventName="Click"/>
                        </Triggers>
                        <ContentTemplate>

                            <div id="yesEve" runat="server" visible="false" style="width:95%; float:right; margin-left:5%; padding-top:20px; margin-bottom:20px;">
                                <table id="mytable" cellspacing="0" runat="server">

                                </table>
                            </div>

                            <div id="errorMsg" runat="server" visible="false" style="width:100%; text-align:center; float:right;">
                                <asp:label visible="true" ID="msg1" Font-Size="Medium" runat="server" Font-Bold="true" Text = "היום נמחק בהצלחה"></asp:label>
                            </div>

                            <div id="noEve" style="width:100%; padding-top:20px; float:right; text-align:center; margin-bottom:20px;" runat="server" visible="false">
                                <asp:label visible="true" ID="stamLabel" Font-Size="Medium" runat="server" Font-Bold="true" Text = "לא קיימים ימים פתוחים"></asp:label>
                            </div>

                            <asp:LinkButton ID ="remove" runat="server"></asp:LinkButton>

                        </ContentTemplate>
                    </asp:UpdatePanel>

I really need some help with that... i m searching for hours all over the web to find an answer. Thanks, Matan

问题回答

在后面的法典中,你可以尝试增加这一行文:

ScriptManager.GetCurrent(Page).RegisterPostBackControl(Button1);   

你们的法典没有任何错误,你在某个地方与你没有显示我们的法典有冲突,或者说瓦 Java的文字错误打破了这一页。

此处用微薄的辅导页为如何做到这一点提供模板:

<asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager>
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
    <ContentTemplate>
        <fieldset>
        <legend>UpdatePanel</legend>
        <asp:Label ID="Label1" runat="server" Text="Panel created."></asp:Label><br />
        </fieldset>
    </ContentTemplate>
    <Triggers>
        <asp:AsyncPostBackTrigger ControlID="Button1" />
    </Triggers>
</asp:UpdatePanel>
<asp:Button ID="Button1" runat="server" OnClick="Button1_Click" Text="Button" />

这方面的更多信息:

http://msdn.microsoft.com/en-us/library/bb399001.aspx” rel=“nofollow”>microsoft tutorial





相关问题
Anyone feel like passing it forward?

I m the only developer in my company, and am getting along well as an autodidact, but I know I m missing out on the education one gets from working with and having code reviewed by more senior devs. ...

How to Add script codes before the </body> tag ASP.NET

Heres the problem, In Masterpage, the google analytics code were pasted before the end of body tag. In ASPX page, I need to generate a script (google addItem tracker) using codebehind ClientScript ...

Transaction handling with TransactionScope

I am implementing Transaction using TransactionScope with the help this MSDN article http://msdn.microsoft.com/en-us/library/system.transactions.transactionscope.aspx I just want to confirm that is ...

System.Web.Mvc.Controller Initialize

i have the following base controller... public class BaseController : Controller { protected override void Initialize(System.Web.Routing.RequestContext requestContext) { if (...

Microsoft.Contracts namespace

For what it is necessary Microsoft.Contracts namespace in asp.net? I mean, in what cases I could write using Microsoft.Contracts;?

Separator line in ASP.NET

I d like to add a simple separator line in an aspx web form. Does anyone know how? It sounds easy enough, but still I can t manage to find how to do it.. 10x!

热门标签