I have a ListView control, I want to edit the InsertItem Template to include a Dropdownlist Item which contains a list of users in Membership Directory.
I tried this:
MembershipUserCollection users = Membership.GetAllUsers();
assigned_volunteerDropDownBox.DataSource = users;
assigned_volunteerDropDownBox.DataBind();
The biggsest issue is that it says assigned_volunteerDropDownBox does not exist in the current context… In fact none of the TextBox items on the insert template are in the current context (is this normal)?
How would I go about doing this? I want to be able to only allow the row to be updated with valid usernames.
I looked at this, but it doesn’t actually contain the code to DataBind to the DropDownList item.
You could access the
assigned_volunteerDropDownBoxfrom code behind; but it’s probably easier to do the binding from the drop down control itself. Create a property to bind to:Then use
DataSourceon theDropDownList: