2011-09-28 72 views
-2

我有一個5步向導控件。 用戶從Drop Downlist,TextBoxes中選擇他的值後,我有一個submit_click事件來將所有選定的值插入到數據庫中。asp.net嚮導控件

下面是我在Submit_Click

try 
       { 

        int result = new objBLL.PostProfile 
        { 
         ProfileId = 1, 
         CasteId = Convert.ToInt32(casteDropDown.SelectedValue), 
         MMBId = iMMBID, 
         UserId = UserId, 
         FullName = Full_Name.Text, 
         Gender = genderDropDown.SelectedValue, 
         Age = Convert.ToInt32(Age.Text), 
         Height = HeightDropDown.SelectedValue, 
         Complexion = ComplexionDropDown.SelectedItem.ToString() 
}.Save(Operation.Insert); 

public class PostProfile 
    { 
     PostProfileDAL objProfileDAL = new PostProfileDAL(); 

     public int ProfileId { get; set; } 
     public int CasteId { get; set; } 
     public int MMBId { get; set; } 
     public Guid UserId { get; set; } 
     public string FullName { get; set; } 
     public string Gender { get; set; } 
     public int Age { get; set; } 
     public string Height { get; set; } 
     public string Complexion { get; set; } 

public int Save(Operation opr) 
     { 
      int result = 0; 
      SqlParameter[] parms = { 
             new SqlParameter("@Profile_Id", ProfileId), 
             new SqlParameter("@Caste_Id", CasteId), 
             new SqlParameter("@MMB_Id", MMBId), 
             new SqlParameter("@User_ID", UserId), 
             new SqlParameter("@Full_Name", FullName), 
             new SqlParameter("@Gender", Gender), 
             new SqlParameter("@Age", Age), 
             new SqlParameter("@Height", Height), 
             new SqlParameter("@Complexion", Complexion) 

            }; 

      try 
      { 
       if (opr == Operation.Insert) 
       { 

        result = DALBASE.SetData("InsertProfileDetails", parms); 
} 

catch (Exception ex) 
      { 
       result = 1; 
       throw ex; 
      } 

因此,這是我遇到的麻煩。 將所有數據發送到.cs文件時,它能夠保留所有文本框值,但是保留了下拉列表框中的所有選定值。

例如:對於DropDownlist膚色,如果我在嚮導控件中選擇值「VeryFair」, 將它發送到保存操作的類文件,則膚色下拉列表的值仍爲「請選擇一個值」

任何幫助表示讚賞 感謝 孫

回答

0

檢查你的嚮導的ViewStateMode屬性。

它應該被啓用而不是繼承。