removing items from a dropdownlist at page_load

M

mharness

Hello,

Under most circumstances I don't have any trouble removing items from a
dropdownlist but this time it's not working.

I have a ddl that list items which, when choosen are added to a gridview on
the same page and removed from the ddl so that they can only be added once.

What I want to do and can't seem to make work is the code that removes the
ddl items that are already on the gridview at page load.

str value below is a valid item in the ddl.

Thanks,

Mike

Protected Sub CullProjects()
'from ddlProjects that are already in gvRequestProjects
Dim row As GridViewRow
If Me.gvRequestProjects.Rows.Count > 0 Then
For Each row In Me.gvRequestProjects.Rows
Dim str As String = CType(row.FindControl("ProjectName"),
LinkButton).Text
Me.ddlProjects.Items.Remove(str)
Next
End If
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,483
Members
44,901
Latest member
Noble71S45

Latest Threads

Top