In the code snippet below, select any value and pressing the button
should display back the value selected. However, this is the way it
behaves. It just resets to the first one in the list so the first item
is always displayed no matter what the use has selected. This is just
because the dropdown list is inside the UI dialog.

In conclusion, any DropDown list contained inside a UI dialog lose its
select state. This means that there is not way to recover the selected
item.

Here is the test code :

<%@ Page Language="C#" AutoEventWireup="true"
CodeBehind="TEST.aspx.cs" Inherits="amimio.TEST1"
EnableViewState="true" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://
www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml";>
<head runat="server">
    <title></title>
    <script src="scripts/jquery-1.3.1.min.js" type="text/javascript"></
script>
    <script src="scripts/jquery/jquery-ui-personalized-1.6rc6.min.js"
type="text/javascript"></script>

    <script type="text/javascript">
        $(document).ready(function() {
        $("#aDialog").dialog({
            autoOpen: false,
            resizable: false,
            buttons: {
                'OK': function() {
                    $(this).dialog('close');
                }
            }
        });
        });
    </script>

</head>
<body>
    <form id="form1" runat="server">
    <div id="aDialog">
    <asp:DropDownList ID="test" runat="server">
        <asp:ListItem text="a" />
        <asp:ListItem text="b" />
        <asp:ListItem text="c" />
    </asp:DropDownList></div>
    <span onclick='$("#aDialog").dialog("open")'>Open Dialog</span>
    <asp:Button ID="btn" Text="Send" runat="server" />
    </form>
</body>
</html>


The code behind file just contains this piece of code :

        protected void Page_Load(object sender, EventArgs e)
        {
            if (Page.IsPostBack)
            {
                Response.Write(test.SelectedItem.Text);
            }
        }


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"jQuery UI" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/jquery-ui?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to