如何仅更新页面的特定部分?

时间:2021-01-15 21:05:16

I am using two update panels in my aspx page. My page also contains other controls most of them are text boxes. some text boxes using ajaxwater mark extender. My problem is when the portion of the panels is updated the watermark textbox also updated. How can I preven this to happen? My page is like ....some other controls and then

我在我的aspx页面中使用了两个更新面板。我的页面还包含其他控件,其中大多数是文本框。一些文本框使用ajaxwater标记扩展器。我的问题是当面板的一部分被更新时,水印文本框也被更新。我怎样才能防止这种情况发生?我的页面就像....其他一些控件然后

<asp:UpdatePanel runat="server" ID="upPanelTestRoll">
                        <ContentTemplate>
                            <fieldset style="height: 70px; float: left; width: 350px;">
                                <legend>Submission</legend>
                                <asp:CheckBox ID="chkSubmitted" runat="server" Height="25px" Width="25px" AutoPostBack="true" />
                                <label for="chkSubmitted">
                                    Submitted</label>
                                <label for="txtSubmissionDate">
                                    Submission Date</label>
                                <asp:TextBox ID="txtSubmissionDate" runat="server" Height="12px" Enabled="false"></asp:TextBox>
                                <cc1:CalendarExtender ID="txtSubmissionDate_CalendarExtender" runat="server" Enabled="True"
                                    TargetControlID="txtSubmissionDate">
                                </cc1:CalendarExtender>
                                <%--<asp:CheckBox ID="chkTestToAppear" runat="server" Height="25px" Width="25px" />
                            <label for="">
                                Test To Appear</label>--%>
                                <br />
                                <label for="txtAdmissionTestRoll">
                                    Admission Test Roll
                                </label>
                                <asp:TextBox ID="txtAdmissionTestRoll" runat="server" Enabled="false"></asp:TextBox>
                        </ContentTemplate>
                    </asp:UpdatePanel>

What to do to optimize the code?

如何优化代码?

1 个解决方案

#1


1  

Change the UpdatePanel.UpdateMode to Conditional.

将UpdatePanel.UpdateMode更改为Conditional。

The content of the UpdatePanel control is updated under the following conditions: If the Update method of the UpdatePanel control is called explicitly.

UpdatePanel控件的内容在以下条件下更新:如果显式调用UpdatePanel控件的Update方法。

If a control is defined as a trigger by using the Triggers property of the UpdatePanel control and causes a postback. In this scenario, the control is an explicit trigger for updating the panel content. The trigger control can be either inside or outside the UpdatePanel control that defines the trigger.

如果通过使用UpdatePanel控件的Triggers属性将控件定义为触发器并导致回发。在此方案中,控件是更新面板内容的显式触发器。触发器控件可以位于定义触发器的UpdatePanel控件的内部或外部。

If the ChildrenAsTriggers property is set to true and a child control of the UpdatePanel control causes a postback. In this scenario, child controls of the UpdatePanel control are implicit triggers for updating the panel. Child controls of nested UpdatePanel controls do not cause the outer UpdatePanel control to be updated unless they are explicitly defined as triggers.

如果ChildrenAsTriggers属性设置为true并且UpdatePanel控件的子控件导致回发。在这种情况下,UpdatePanel控件的子控件是用于更新面板的隐式触发器。嵌套UpdatePanel控件的子控件不会导致更新外部UpdatePanel控件,除非它们被明确定义为触发器。

#1


1  

Change the UpdatePanel.UpdateMode to Conditional.

将UpdatePanel.UpdateMode更改为Conditional。

The content of the UpdatePanel control is updated under the following conditions: If the Update method of the UpdatePanel control is called explicitly.

UpdatePanel控件的内容在以下条件下更新:如果显式调用UpdatePanel控件的Update方法。

If a control is defined as a trigger by using the Triggers property of the UpdatePanel control and causes a postback. In this scenario, the control is an explicit trigger for updating the panel content. The trigger control can be either inside or outside the UpdatePanel control that defines the trigger.

如果通过使用UpdatePanel控件的Triggers属性将控件定义为触发器并导致回发。在此方案中,控件是更新面板内容的显式触发器。触发器控件可以位于定义触发器的UpdatePanel控件的内部或外部。

If the ChildrenAsTriggers property is set to true and a child control of the UpdatePanel control causes a postback. In this scenario, child controls of the UpdatePanel control are implicit triggers for updating the panel. Child controls of nested UpdatePanel controls do not cause the outer UpdatePanel control to be updated unless they are explicitly defined as triggers.

如果ChildrenAsTriggers属性设置为true并且UpdatePanel控件的子控件导致回发。在这种情况下,UpdatePanel控件的子控件是用于更新面板的隐式触发器。嵌套UpdatePanel控件的子控件不会导致更新外部UpdatePanel控件,除非它们被明确定义为触发器。