本来是很简单的事,但是弄起来复杂无比,还有些可笑。
我把DropDownList的DataValueField 设置int型,
然后把int型的sea.DiaryType给它,居然不行。
然后转换成了string型。
给了只能接受string的DropDownList1.SelectedValue 
然后他在转换成int行,进行初始设定。
真不明白为什么它不直接接受个int型?就不用来回转换了。
后台代码:
            DropDownList1.DataSource = sea.typesource();
DropDownList1.DataTextField = "TDType";
DropDownList1.DataValueField = "TDid";
DropDownList1.SelectedValue = sea.DiaryType.ToString();
DropDownList1.DataBind();
  
DropDownList1.DataTextField = "TDType";
DropDownList1.DataValueField = "TDid";
DropDownList1.SelectedValue = sea.DiaryType.ToString();
DropDownList1.DataBind();
 
                    
                     
                    
                 
                    
                 
 
         
                
            
         浙公网安备 33010602011771号
浙公网安备 33010602011771号