Ich habe eine ASP DropDownList, die auf dem Page_Load Ereignis gefüllt wird, nachdem ich ein Element auswählen und eine Schaltfläche drücken das ausgewählte Element wird gelöscht und das erste Element in der DropDownList wird ausgewählt. (Die Dropdownlist ist nur gefüllt, wenn die Seite nicht Postbacks)ASP.NET DropDownList nicht ausgewählte Element auf Postback
Hilfe bitte
if (!IsPostBack)
{
List<Country> lCountries = new List<Country>();
List<CompanySchedule> lCompanySchedules = new List<CompanySchedule>();
this.Load_Countries(lCountries);
this.Load_Schedules(lCompanySchedules);
if (personnelRec == null)
{ personnelRec = new Personnel(); }
if (Request.QueryString["UA"] != null && Convert.ToInt32(Request.QueryString["UA"].ToString()) > 0)
{
userAccount.ID = Convert.ToInt32(Request.QueryString["UA"].ToString());
App_Database.Snapshift_Select_Helper.SNAPSHIFT_SELECT_PERSONNEL_APP_ACCOUNT(ref userAccount);
}
this.imgEmployeePicture.ImageUrl = "./images/Employees/nophoto.gif";
if (Request.QueryString["EI"] != null && Convert.ToInt32(Request.QueryString["EI"].ToString()) > 0)
{
this.Load_PersonnelRec(Convert.ToInt32(Request.QueryString["EI"].ToString()));
}
else
{
this.lblChangeDirectionHead.Enabled = false;
this.lblChangeDirections.Enabled = false;
this.lbSchedules.Disabled = true;
}
}
Geben Sie den Code für Ihr Page_Load-Ereignis ein. Das wird bei der Beantwortung helfen. –
Haben Sie ein "if (! IsPostBack)" um Ihren Bevölkerungscode herum? – russau
Ich sehe keine DropDownList in Ihrem Code. Wird es durch 'this.Load_Countries (lCountries);'? Wo versuchst du auch den ausgewählten Wert zu bekommen? –