Binding problem with DropDownList? (repost)

P

Paul Owen

I have been pulling my hair out (what is left of it) for a few days trying to
figure out what is wrong with this..

I have a repeater control that renders a number of controls bound to a
datasource. Within this repeater, there are a number of dropdownlists which
have their datasource set to different picklists which need to be sync'ed to
the main source. This never happens however I have tried it. First I had a
problem identifying the control but I think I solved that. Now when I debug,
I find that the items in the ddl is
0. I have tried to databind the control, but I get a stack overflow. At the
moment I am calling:

OnDataBound='<%#GetTypeIndex((Container.FindControl("DIrectorate_ID")),
Container.DataItem("directorate name"))%>'

The code called is the following:

Public Function GetTypeIndex(ByVal c As Control, ByVal Type_Name As String)
As Integer
Dim lb As DropDownList
lb = c
'Response.Write(c.ID)
' Response.Write(Type_Name)
' Response.Write(lb.Items.Count)
' Response.End()


Dim li As ListItem
Dim index As Integer

For Each li In lb.Items
If li.Text = Type_Name Then
li.Selected = True
index = lb.SelectedIndex
End If
Next

Return index

End Function

Am I going completely mad on this?
 

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,777
Messages
2,569,604
Members
45,227
Latest member
Daniella65

Latest Threads

Top