Re: Problem with dropdownlist

  •  10-28-2008, 2:38 AM

    Re: Problem with dropdownlist

    Hi jfeeney,
     
    I can not reproduce this issue,please tyr this code:
     
    When I selected a value from DropDownList1 and click the save button of editor,the value of DropDownList1 still is my choice.

    <%@ Page Language="C#" %>

    <%@ Register TagPrefix="CE" Namespace="CuteEditor" Assembly="CuteEditor" %>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

    <script runat="server">
        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);
            if (!IsPostBack)
            {
                ArrayList values = new ArrayList();

                values.Add("Apple");
                values.Add("Orange");
                values.Add("Pear");
                values.Add("Banana");
                values.Add("Grape");

                // Set the DataSource of the Repeater.
                DropDownList1.DataSource = values;
                DropDownList1.DataBind();

            }
        }
        protected void DropDownList1_SelectedIndexChanged(object sender, EventArgs e)
        {
            Editor1.Text = DropDownList1.SelectedItem.Value;

            Label1.Text = "Working on...." + DropDownList1.SelectedItem.Text;
        }

        protected void Editor1_PostBackCommand(object sender, CommandEventArgs e)
        {
            this.Label1.Text = "saved to...." + DropDownList1.SelectedItem.Text;
        }

    </script>

    <html xmlns="http://www.w3.org/1999/xhtml">
    <head id="Head1" runat="server">
        <title>Welcome to Quattro Html Editor</title>
    </head>
    <body>
        <form id="form1" runat="server">
            <div>
                <asp:DropDownList ID="DropDownList1" runat="server" AutoPostBack="True" OnSelectedIndexChanged="DropDownList1_SelectedIndexChanged">
                </asp:DropDownList>
                <CE:Editor ID="Editor1" runat="server" OnPostBackCommand="Editor1_PostBackCommand">
                </CE:Editor>
            </div>
            <asp:Label ID="Label1" runat="server" Text="Label"></asp:Label>
              </form>
    </body>
    </html>
     
     
     
    Regards,
     
    Ken
View Complete Thread