asp.net wizard control
I have a Wizard control with 5steps. After the user selects his values from the Drop Downlist, TextBoxes, I have a submit_click event to insert all the selected values in the DB.
Here's what I have in the 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;
}
So this is where I am having trouble. While sending all the data into the .cs file, it is able to retain all the textbox values, but none of the selected values in the Drop Downlists, listboxes are retained.
For Eg: For DropDownlist complexion, if I select a value "VeryFair" in the wizard control, on sending it to the class file to the Save Operation, the value of the Complexion Drop Down is still "Please select a value"
开发者_运维技巧Any help is appreciated Thanks Sun
Check for the ViewStateMode property of your Wizard.
It should be enabled instead of inherit.
精彩评论