0

I have a div , within which I have a button and an asp.net dropdownlist. I can change the value in the dropdownlist . But as soon as the button is clicked the value in the drop down list is again set to the default initial value. Is there a way I can solve this problem ? I do not want the dropdownlist to go back to its initial value.

aspx

<div id='one'>
     <asp:LinkButton ID="ConfigureAlerts" OnClick="btnConfigureAlerts_Click" runat="server">Configure Alerts</asp:LinkButton>
    </div>
    <div id="ViewModalPopupDiv2">
            <asp:UpdatePanel ID="UpdatePanel3" runat="server">
                <ContentTemplate>
                <asp:Panel ID="Panel2" runat="server" HorizontalAlign="left" ScrollBars="Auto">
                <asp:Button ID="btnGetLogs" runat="server" Text="SendAlerts" OnClick="btnSendAlertEmail_Click"/>
<asp:Label ID="Label2" runat="server" Text="Set The Alert Email Interval to every :" CssClass="label"
                                    ForeColor="Black"></asp:Label>&nbsp&nbsp&nbsp
           <asp:DropDownList ID="ddlTimeInterval" runat="server" >
                                    <asp:ListItem Text="15MIN" Value="15"></asp:ListItem>
                                    <asp:ListItem Text="30MIN" Value="30"></asp:ListItem>
                                    <asp:ListItem Text="1Hr" Value="60"></asp:ListItem>
                                    <asp:ListItem Text="2Hrs" Value="120"></asp:ListItem>
                                    <asp:ListItem Text="8Hrs" Value="480"></asp:ListItem>
                                    <asp:ListItem Text="24Hrs" Value="1440"></asp:ListItem>
                                    <asp:ListItem Text="48Hrs" Value="2880"></asp:ListItem>
                                </asp:DropDownList>
                                <br />                
</asp:Panel>
                </ContentTemplate>
            </asp:UpdatePanel>
        </div>

javascript

function ViewModelPopup2() {
        $("#ViewModalPopupDiv2").dialog({
                scrollable: true,
                width: 800,
                modal: true
            });
        }

ASPX.CS

protected void btnSendAlertEmail_Click(object sender, EventArgs e)
        {

            // Code to send email

        }

protected void btnConfigureAlerts_Click(object sender, EventArgs e)
        {

        ScriptManager.RegisterStartupScript
                       (this, this.GetType(), "callScriptFunction", "ViewModelPopup2();", true);
        }
    }
4
  • Can you show the server side code where you setting the value of the dropdown? Commented Sep 11, 2013 at 19:10
  • Duplicate? stackoverflow.com/questions/18745353/… Commented Sep 11, 2013 at 19:21
  • Hey Stanley That question is different. Here I have the drop down values changing, but as soon as I click the button , the drop downlist goes back to the initial value. Example if I had x as the initial value and I changed the value to y . As soon as I click the button the value goes back to x Commented Sep 11, 2013 at 19:31
  • Hey Irfan ! I have the different drop down values in the aspx file itself. There is no special code to in the server side to set the values. Commented Sep 11, 2013 at 19:33

1 Answer 1

0

The problem i can see is that , JQuery and Update Panel. These two never works together properly. You need to remove either. But there is a work around. Check out this one.http://www.codeproject.com/Articles/601683/Working-with-jQuery-within-the-ASP-NET-UpdatePanel

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.