locked
Partial page update question RRS feed

  • Question

  • User-26029311 posted
    Why isn't this section of code not calling my chkShowLegend_CheckedChanged in my code behind?  I can put the same code that changes the visible to true/false based on checked in my PageLoad, and it works...otherwise, I take it out of the PageLoad and just leave it in the chkShowLegend_CheckedChanged and it doesn't work.  Here's my code:
            <asp:ScriptManager ID="ScriptManager1" runat="server" EnablePartialRendering="true" />
            <asp:UpdatePanel ID="UpdatePanel2" runat="server" UpdateMode="Conditional">
                <ContentTemplate>
                    <asp:CheckBox ID="chkShowLegend"  runat="server" AutoPostBack="True" Text="Notification Legend" /> 
                    <asp:Panel ID="Legend" runat="server" Visible="false">
                        <div id="lblLegend" style="Z-INDEX: 3; WIDTH: 477px; HEIGHT: 115px; border: solid 1px; padding-right: 5px; padding-left: 7px; padding-bottom: 5px; padding-top: 5px;"
                        align="left" runat="server">
                            <font face="Arial" size="4">
                                <span style="font-size: 10pt;">
                                    <span style="color: black"><strong>Black Text</strong></span> - Interval value received; operating environment normal<br />
                                    <span style="color: gray"><strong>Gray Text</strong></span> - Interval value not received; previous valid interval substituted<br />
                                    <span style="color: royalblue"><strong>Blue Text</strong></span> - Setpoint has changed from previous interval value<br />
                                    <span style="color: crimson"><strong>Red Text</strong></span> - OOME for this interval<br />
                                    <span style="color: darkorange"><strong>Orange Text</strong></span> - SCADA value is out of range compared to setpoints<br />
                                    <span style="color: forestgreen"><strong>Green Text</strong></span> - LIP value has a different sign (+/-) compared to previous interval<br />
                                    *Please check above indicators for current interval; multiple indicators are possible
                                </span>
                            </font>
                        </div>
                    </asp:Panel>
                </ContentTemplate>
                <Triggers>
                    <asp:AsyncPostBackTrigger ControlID="chkShowLegend" EventName="CheckedChanged" />
                </Triggers>
            </asp:UpdatePanel>
    
    In my code behind:
    
        protected void chkShowLegend_CheckedChanged(object sender, EventArgs e)
        {
            if (chkShowLegend.Checked)
                Legend.Visible = true;
            else
                Legend.Visible = false;
        }
     
    
    Thursday, March 22, 2007 3:46 PM

Answers

  • User-1628869372 posted

    I have tried your code, its working perfectly for me without any modification to your code.

    can you try by removing <triggers> section of update panel since chkbox is inside the updatepanel it will automatically taken as a trigger(since childrenastriggers property of updatepanel is having default value "true").

    Some references. 

    http://ajax.asp.net/docs/mref/P_System_Web_UI_UpdatePanel_ChildrenAsTriggers.aspx 

    http://ajax.asp.net/docs/mref/P_System_Web_UI_UpdatePanel_UpdateMode.aspx 

    I suppose you are using other update panels alose on the page. which may causing the issue.In that case its better if you can put the complete page code so that we can look into that.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Friday, March 23, 2007 2:22 AM

All replies

  • User-1628869372 posted

    I have tried your code, its working perfectly for me without any modification to your code.

    can you try by removing <triggers> section of update panel since chkbox is inside the updatepanel it will automatically taken as a trigger(since childrenastriggers property of updatepanel is having default value "true").

    Some references. 

    http://ajax.asp.net/docs/mref/P_System_Web_UI_UpdatePanel_ChildrenAsTriggers.aspx 

    http://ajax.asp.net/docs/mref/P_System_Web_UI_UpdatePanel_UpdateMode.aspx 

    I suppose you are using other update panels alose on the page. which may causing the issue.In that case its better if you can put the complete page code so that we can look into that.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Friday, March 23, 2007 2:22 AM
  • User-26029311 posted

    Removing the trigger section worked perfectly.  I do have multiple update panels on this page and I was wondering if that was causing problems; the other two have timers as triggers, a 1 second timer and a 30 second timer.

    Thanks for the help!

    Friday, March 23, 2007 11:35 AM