First Item in dropdownlist doesn't fire SelectedIndexChanged at all

后端 未结 7 2175
盖世英雄少女心
盖世英雄少女心 2021-02-20 12:24

I have following simple code:

<%@ Page Language=\"C#\" AutoEventWireup=\"true\" CodeBehind=\"testForm.aspx.cs\" Inherits=\"Orbs.testForm\" %>

         


        
7条回答
  •  野性不改
    2021-02-20 12:33

    This is happening because you are setting the label to "???!!" every page event.

    You need to modify your page load to detect f a Postback has not occured.

        protected void Page_Load(object sender, EventArgs e) {
            if(!IsPostBack)
            {
                label1.Text = "???!!";
            }
        }
    

提交回复
热议问题