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

No members online now.

Forum statistics

Threads
473,994
Messages
2,570,223
Members
46,810
Latest member
Kassie0918

Latest Threads

Top