How can you assign a javascript variable with DropDownList value(selection_changed)
<p>I have a <code>DropDownList</code> that will be used multiple times so I have a have a <code>selection_change</code> attribute. Now, I am trying to get a user to select a file id inside the list. Then I use the id he selected and run a stored procedure. The first time I move the files it works, but the second time(when he selects another file) it fails. My question is how do i reassign the javascript value with the <code>selection_change</code> value?</p>

<p>here is my functions:</p>

<pre><code>function getCaseFiles(canMoveExpenses) {
        //create Popup with content from div
        $('#ddlFiles').dialog({
            autoOpen: true,
            height: 'auto',
            width: 'auto',
            modal: true,
            buttons: {
                "Ok": function () {
                    //                        var newCaseDdl = document.getElementById("ddlCaseFilesNew");
                    //                        var newCaseDdlInt = newCaseDdl.options[newCaseDdl.selectedIndex].value;
                    var newCaseDdl = ddlCaseFilesNew.options[ddlCaseFilesNew.selectedIndex].value;
                    alert("newCaseDdl = " + newCaseDdl);


                    var oldCaseFile = $("#hidCaseFile").val();
                    alert(oldCaseFile);

                    if (newCaseDdl != -1) {
                        moveCasefile(canMoveExpenses, newCaseDdl, oldCaseFile);
                        $(this).dialog('close');
                    }
                    else {
                        showMessage("Error. Please Select a Value From The Lists.");
                    }
                },
                Cancel: function () {
                    newCaseDdl = null;
                    oldCaseDdl = null;
                    $(this).dialog('close');
                }
            }
        });
    }
</code></pre>

<p>my drop down list div:</p>

<pre><code>&lt;div id="ddlFiles"&gt;
    &lt;label&gt;
        Select new CaseFile:&lt;/label&gt;
    &lt;asp:DropDownList runat="server" ID="ddlCaseFilesNew" DataSourceID="dsCaseFiles"
        DataTextField="Display" DataValueField="FileID" 
        OnPreRender="ddl_PreRender"  
        Width="300px" /&gt;
&lt;/div&gt;
</code></pre>

<p>code behind for the dropdownlist :</p>

<pre><code>if (Request.QueryString["ExpenseID"] != null)
    {
        if (!IsPostBack)
        {
            ddlCaseFilesNew.DataSourceID = "dsCaseFiles";
            ddlCaseFilesNew.SelectedIndex = -1;
            ddlCaseFilesNew.DataTextField = "Display";
            ddlCaseFilesNew.DataValueField = "FileID";
            ddlCaseFilesNew.DataBind();
            ddlCaseFilesNew.Attributes.Add("onchange", "getValue();");
        }
    }
</code></pre>
