You must Sign In to post a response.
  • Category: ASP.NET

    Variable value not being updated in updatepanel

    I have an update panel where I have a dropdown set to autopostback true.
    Depending on the selection in the dropdown, a variable value is updated. Based on the variable I am allowing the user to navigate from the page.

    But if I use the update panel, the variable value is not being updated, keeping the old value that it gets during load.
  • #765809
    have you added Trigger for dropdown .
    <asp:UpdatePanel ID="UpdatePanel1" runat="server">
    <asp:AsyncPostBackTrigger ControlID="DropDownList1" EventName="SelectedIndexChanged" />

    for more information check

  • #765815
    if it put old value that was set during page load then it looks you have not set Page.IsPostback in your code.
    according to page life cycle on server request page gets postback and it is dispose and reload again so when you fire selected index changed your page load gets call again
    if there is not IsPostBack property present inside page_load then your old value may get replaced

    Editor, DotNetSpider MVM
    Microsoft MVP 2014 [ASP.NET/IIS]

  • #765832

    Have you debug your code, whether the events which you raised for updating the records has been trigger or not, if it is trigger while page load whether the new data has been fetched from database or not? to clear these all question you have to debug your code, then only you come to know the exact problem.

    Give respect to your work, Instead of trying to impress your boss.

    Blog :

  • Sign In to post your comments