Disable/remove value in dropdown menu after being selected

后端 未结 1 812
无人共我
无人共我 2021-01-28 21:03

Just wanna ask u guys for help. I have this dropdown menu in my abc.aspx page. There, user will choose month and enter the expenses and prices in the textbox provided. It will b

1条回答
  •  旧巷少年郎
    2021-01-28 21:33

    Why not try the following:

    ASPX

    
        
        
        
        
    
    

    C#

        protected void DropDownList1_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (Session["Month"] != null)
            {
                if (DropDownList1.SelectedValue == Session["Month"])
                {
                    DropDownList1.SelectedValue = string.Empty;
                }
                else
                {
                    Session["Month"] = DropDownList1.SelectedValue;
                }
            }
        }
    

    Make this is the ASPX and C# on your first page.

    0 讨论(0)
提交回复
热议问题