当前位置: 代码迷 >> ASP.NET >> ddl的aotopostback 这段代码有误?该如何处理
  详细解决方案

ddl的aotopostback 这段代码有误?该如何处理

热度:9697   发布时间:2013-02-25 00:00:00.0
ddl的aotopostback 这段代码有误?
C# code
protected void Page_Load(object sender, EventArgs e)    {        if (!IsPostBack)        {            DDLFamilyRelationship1st.Items.Insert(0, new ListItem("-请选择-", "0"));            DDLFamilyRelationship2nd.Items.Insert(0, new ListItem("-请选择-", "0"));            DDLFamilyRelationship3th.Items.Insert(0, new ListItem("-请选择-", "0"));            DDLFamilyRelationship4th.Items.Insert(0, new ListItem("-请选择-", "0"));            if (DDLSex.Text == "男")            {                DDLFamilyRelationship1st.Items.Insert(1, new ListItem("父子", "0"));                DDLFamilyRelationship1st.Items.Insert(2, new ListItem("母子", "0"));                DDLFamilyRelationship1st.Items.Insert(3, new ListItem("夫妻", "0"));                DDLFamilyRelationship1st.Items.Insert(4, new ListItem("兄妹", "0"));                DDLFamilyRelationship1st.Items.Insert(5, new ListItem("姐弟", "0"));                DDLFamilyRelationship2nd.Items.Insert(1, new ListItem("父子", "0"));                DDLFamilyRelationship2nd.Items.Insert(2, new ListItem("母子", "0"));                DDLFamilyRelationship2nd.Items.Insert(3, new ListItem("夫妻", "0"));                DDLFamilyRelationship2nd.Items.Insert(4, new ListItem("兄妹", "0"));                DDLFamilyRelationship2nd.Items.Insert(5, new ListItem("姐弟", "0"));                DDLFamilyRelationship3th.Items.Insert(1, new ListItem("父子", "0"));                DDLFamilyRelationship3th.Items.Insert(2, new ListItem("母子", "0"));                DDLFamilyRelationship3th.Items.Insert(3, new ListItem("夫妻", "0"));                DDLFamilyRelationship3th.Items.Insert(4, new ListItem("兄妹", "0"));                DDLFamilyRelationship3th.Items.Insert(5, new ListItem("姐弟", "0"));                DDLFamilyRelationship4th.Items.Insert(1, new ListItem("父子", "0"));                DDLFamilyRelationship4th.Items.Insert(2, new ListItem("母子", "0"));                DDLFamilyRelationship4th.Items.Insert(3, new ListItem("夫妻", "0"));                DDLFamilyRelationship4th.Items.Insert(4, new ListItem("兄妹", "0"));                DDLFamilyRelationship4th.Items.Insert(5, new ListItem("姐弟", "0"));            }            if (DDLSex.Text == "女")            {                DDLFamilyRelationship1st.Items.Insert(1, new ListItem("父女", "0"));                DDLFamilyRelationship1st.Items.Insert(2, new ListItem("母女", "0"));                DDLFamilyRelationship1st.Items.Insert(3, new ListItem("夫妻", "0"));                DDLFamilyRelationship1st.Items.Insert(4, new ListItem("兄妹", "0"));                DDLFamilyRelationship1st.Items.Insert(5, new ListItem("姐弟", "0"));                DDLFamilyRelationship2nd.Items.Insert(1, new ListItem("父女", "0"));                DDLFamilyRelationship2nd.Items.Insert(2, new ListItem("母女", "0"));                DDLFamilyRelationship2nd.Items.Insert(3, new ListItem("夫妻", "0"));                DDLFamilyRelationship2nd.Items.Insert(4, new ListItem("兄妹", "0"));                DDLFamilyRelationship2nd.Items.Insert(5, new ListItem("姐弟", "0"));                DDLFamilyRelationship3th.Items.Insert(1, new ListItem("父女", "0"));                DDLFamilyRelationship3th.Items.Insert(2, new ListItem("母女", "0"));                DDLFamilyRelationship3th.Items.Insert(3, new ListItem("夫妻", "0"));                DDLFamilyRelationship3th.Items.Insert(4, new ListItem("兄妹", "0"));                DDLFamilyRelationship3th.Items.Insert(5, new ListItem("姐弟", "0"));                DDLFamilyRelationship4th.Items.Insert(1, new ListItem("父女", "0"));                DDLFamilyRelationship4th.Items.Insert(2, new ListItem("母女", "0"));                DDLFamilyRelationship4th.Items.Insert(3, new ListItem("夫妻", "0"));                DDLFamilyRelationship4th.Items.Insert(4, new ListItem("兄妹", "0"));                DDLFamilyRelationship4th.Items.Insert(5, new ListItem("姐弟", "0"));            }            else            {                DDLFamilyRelationship2nd.Items.Insert(0, new ListItem("-请选择-", "0"));            }        }    }
  相关解决方案