menelaussa 0 Newbie Poster

I have the following code for !IsPostBack wich is woking fine

if (!IsPostBack && !string.IsNullOrEmpty(contractId))
{
ddlCountry.DataBind();
ddlAgency.DataBind();
ddlChain.DataBind();
ddlLocation.DataBind();


InitializeSession(contract);


txtHotel.Text = SessionHandler.Name;
txtAddress.Text = SessionHandler.Address;
txtPhone.Text = SessionHandler.Phone;
txtFax.Text = SessionHandler.Fax;
txtEmail.Text = SessionHandler.Email;
txtZIPCode.Text = SessionHandler.ZipCode;
txtWebAddress.Text = SessionHandler.WebAddress;
txtCity.Text = SessionHandler.City;
ddlCountry.SelectedValue = SessionHandler.Country;
ddlLocation.SelectedValue = SessionHandler.Location;
ddlChain.SelectedValue = SessionHandler.Chain;
ddlAgency.SelectedValue = SessionHandler.Agency;
}

but for IsPostBack, I cannot save the SelectedValues form the dropdownlist. for this I have the following code:

else
{
ddlCountry.DataBind();
ddlAgency.DataBind();
ddlChain.DataBind();
ddlLocation.DataBind();
Validate();
btnBoardPersonGroup.Enabled = false;


contract = new SupplierContract();
SaveSession();
}

Can you help me, please?
Thank you

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.