protected void Page_Load(object sender, EventArgs e) { UserPayee payee = (UserPayee)Session["PaymentInProgress_payee"]; Debug.WriteLine(payee.Nickname); Debug.WriteLine(payee.UserPayeeId); Debug.WriteLine(payee.UserId); // Validate that the UserId coming from UserPayee matches the one authenticated, else redirect to /Account/Default if (payee.UserId != User.Identity.GetUserId()) { Response.StatusCode = 403; Response.Redirect("/Account/Default"); } // Fill in Fields about the UserPayee txtNickname.Text = payee.Nickname; txtAccountNumber.Text = payee.PayeeAccountNumber; hdnExistingUserPayeeId.Value = payee.UserPayeeId; foreach (var fundingSources in FundingSourceDb.GetFundingSources(User.Identity.GetUserId()).ToList()) { ddlFundingSource.Items.Add(new ListItem { Text = fundingSources.Nickname.ToString(), Value = fundingSources.FundingSourceId.ToString() }); } }
protected void ddlFundingSource_DataBinding(object sender, EventArgs e) { DropDownList ddlFundingSource = (DropDownList)(sender); // Fill your ddl here (eg. ddl.Items.Add("abc", xyz"); // Make sure the value you are going to set the selected item to has been added foreach (var fundingSources in FundingSourceDb.GetFundingSources(User.Identity.GetUserId()).ToList()) { ddlFundingSource.Items.Add(new ListItem { Text = fundingSources.Nickname.ToString(), Value = fundingSources.FundingSourceId.ToString() }); } }