C
Cirene
In a certain condition I want to 'detach' a dropdownlist from it's
datasource, clear it, and put in my own items via code.
I tried it like this....
ddlCreatedBy.DataSource = ""
ddlCreatedBy.DataSourceID = ""
ddlCreatedBy.DataTextField = ""
ddlCreatedBy.DataValueField = ""
ddlCreatedBy.Items.Clear()
:
:
Dim li As New ListItem(Membership.GetUser.UserName,
iCompanyUserId)
ddlCreatedBy.Items.Add(li)
ddlCreatedBy.SelectedIndex = 0
ddlCreatedBy.Enabled = False
I can see that ddlCreatedBy has 0 items before and 1 item after the Add, but
the dropdownlist shows up with no items.
Any idea why?
Thanks!
datasource, clear it, and put in my own items via code.
I tried it like this....
ddlCreatedBy.DataSource = ""
ddlCreatedBy.DataSourceID = ""
ddlCreatedBy.DataTextField = ""
ddlCreatedBy.DataValueField = ""
ddlCreatedBy.Items.Clear()
:
:
Dim li As New ListItem(Membership.GetUser.UserName,
iCompanyUserId)
ddlCreatedBy.Items.Add(li)
ddlCreatedBy.SelectedIndex = 0
ddlCreatedBy.Enabled = False
I can see that ddlCreatedBy has 0 items before and 1 item after the Add, but
the dropdownlist shows up with no items.
Any idea why?
Thanks!