I know I'm coming off as a whiny-brat but working with this datarepeater control is so frustrating! No matter how much I read about it and how much I try things, I just cannot get it to work like I want. I'm sure most of the problems are my own ignorance. I'm finishing up my 5th day trying to get comboboxes to work in a dr.
I have three main problems currently, two of which I've posted here on this forum but haven't received an answer as yet. The 3rd is that, if there is more than one row in the dr, and all rows have a combobox control, then changing the selection in one combo changes them all. Here is my code. I've noticed that the "For Each s As String..." loop never gets executed. Might thisbe causing the problem and if so, how do I resolve it?
Private Sub PeopleTypes_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
LoadComboBox()
PeopleTypesDatarepeater.BeginResetItemTemplate()
strSQL = "SELECT * FROM viewPeopleTypes WHERE PeopleID = " & intID
daPeopleTypes = New SqlDataAdapter(strSQL, connPeopleTypes)
daPeopleTypes.Fill(dt)
bs.DataSource = dt
PeopleTypesDatarepeater.EndResetItemTemplate()
PeopleTypesDatarepeater.DataSource = bs
If bs.Count = 0 Then
btnDelete.Visible = False
Else
btnDelete.Visible = True
End If
End Sub
Private Sub LoadComboBox()
daPTCombo = New SqlDataAdapter( _
"SELECT * FROM tlkpPeopleTypes ORDER BY PeopleType", connPeopleTypes)
'set up People Type combo box
daPTCombo.Fill(dsPTCombo, "tlkpPeopleTypes")
cboPeopleType.DataSource = dsPTCombo.Tables("tlkpPeopleTypes")
cboPeopleType.DisplayMember = "PeopleType"
cboPeopleType.ValueMember = "PeopleTypeID"
cboPeopleType.Text = ""
End Sub
Private Sub PeopleTypesDatarepeater_ItemCloned(ByVal sender As Object, ByVal e As Microsoft.VisualBasic.PowerPacks.DataRepeaterItemEventArgs) Handles PeopleTypesDatarepeater.ItemCloned
Dim Source As ComboBox = _
CType(PeopleTypesDatarepeater.ItemTemplate.Controls.Item("cboPeopleType"), ComboBox)
Dim ComboBox1 As ComboBox = _
CType(e.DataRepeaterItem.Controls.Item("cboPeopleType"), ComboBox)
For Each s As String In Source.Items
ComboBox1.Items.Add(s)
Next
End Sub
I've not done much reading about VS2010. Has the dr control improved any? If so, it may worth an upgrade since I can see where I will need this a lot as I convert old Access mdb's to .Net.
Thanks for any help or advice.