ウィザードを使用しています。ステップ 2 では、保存する場所に関する情報を追加できます。彼は好きなだけ場所を追加できます。ステップ 3 では、特定の場所に関する詳細情報を入力します。使用する場所を選択するには、ユーザーが入力したときに入力する ASP:dropdownlist があります。インデックスを変更したいのですが、うまくいきません デバッグしようとすると、関数に入りません。ラベルを使用してデバッグしています。
選択したアイテムを変更すると、ページがリロードされ、ドロップダウン リストの最初のアイテムが常に選択されます。なぜそれが起こるのか理解できません
ここに私が持っているものがあります ASPXファイル
Select location to enter data for:
<asp:DropDownList ID="s3_location_list" runat="server" AutoPostBack="true" OnSelectedIndexChanged="stepThree_location_list_SelectedIndexChanged">
                </asp:DropDownList>
                   Current location index:
                <asp:Label ID="Label3" runat="server" Text="Label"></asp:Label>
CS ファイル
/*ここでドロップダウン リストにデータを追加します
protected void stepTwo_addLocationData(object Sender, System.EventArgs e)
    {
        //initialize a temporary string array to get all the data from the form
        //Console.Write("AAAAA"+ Context.Items["IsRefreshed"]);
        Boolean refreshed = (Boolean)Context.Items["IsRefreshed"];
        if (!refreshed)
        {
            //if user is adding a new entry to the location table
            LocationData new_location = new LocationData();
            //add stuff to locationData
            if (stepTwo_locationTableIndex == -1)
            {
                //add the new_location element into the location_data array
                location_data.Add(new_location);
                //redraw the table
                DataRow dr = dt.NewRow();
                dr["Location"] = new_location.City;
                //dr["Name"] = loc;
                dt.Rows.Add(dr);
            }
            else
            {
                location_data[stepTwo_locationTableIndex] = new_location;
                dt.Rows[stepTwo_locationTableIndex]["Location"] = City.Text;
            }
            GridView1.DataSource = dt.DefaultView;
            GridView1.DataBind();
            ///CreateTable();
            stepFive_setLocationListOptions();
            stepThree_setLocationListOptions();
            stepTwo_resetForm();
     }
/*これはステップ 3 でのページ読み込みです
protected void stepThree_load()
    {
        if (!IsPostBack && Session["s_s3_locationDropdownIndex"] == null)
        {
            stepThree_locationDropdownIndex = s3_location_list.SelectedIndex;
            Session["s_s3_locationDropdownIndex"] = stepThree_locationDropdownIndex;
        }
        else
        {
            stepThree_locationDropdownIndex = (int) Session["s_s3_locationDropdownIndex"];
        }
        s3_location_list.SelectedIndex = stepThree_locationDropdownIndex;
        Label3.Text = "" + s3_location_list.SelectedIndex;
    }
/*これは、リストを入力する場所です
    protected void stepThree_setLocationListOptions()
    {
        s3_location_list.Items.Clear();
        int i = 0;
        foreach (LocationData item in location_data)
        {
            s3_location_list.Items.Add(new ListItem(item.City, "" + i));
        }
        s3_location_list.DataBind();
    }
/* これは、選択されたインデックスが変更されたときに呼び出される関数です。
    protected void stepThree_location_list_SelectedIndexChanged(object sender, EventArgs e)
    {
        Label3.Text = "Hello";
    }