Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>autopostback="true" on your textbox is causing this, since both controls are reloaded after they leave the textbox. I doubt there is a way to avoid this as long as they are in the same UpdatePanel. </p> <p>Maybe you could set focus to the dropdown list after the textbox-initiated postback, or you could probably make this work by putting the controls in separate UpdatePanels. But really it seems the wrong way to go about it. I would use javascript (and ajax if the logic is complicated) to update the APY. Or just add a "calculate" button...</p> <p>(Edit) Here's a slightly ugly hack to avoid ajax, three update panels and still be able to do your logic server side. I do not approve of this method but it is quick and dirty.</p> <p>Put the Label control that contains the calculation results in an UpdatePanel. The input controls do not need to be in an UpdatePanel.</p> <p>In the update panel (with the results) have a hidden submit button:</p> <pre><code> &lt;asp:Button ID="DoCalculate" style="display:none;" UseSubmitBehavior="false" runat="server" OnClick="Recalculate()" /&gt; </code></pre> <p>This should be the trigger for the UpdatePanel. Then have your two input controls click that button using javascript to cause a partial postback to the "results" panel. Here is the code to add this javascript for the dropdown, for example, in <code>Page_Load</code>:</p> <pre><code> ddSelectedTerm.Attributes.Add("onSelectedIndexChanged", "document.getElementByID('" + DoCalculate.ClientID + "').Click()"); </code></pre> <p>Then in put the C# code to do the calculation and update the label in the 2nd update panel in the "Recalculate()" method.</p> <p>This should work, and give you better layout control and less code flow ugliness then using 3 update panels.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload