Here you go, I've included the other bits which could be the culprit as
well.
Many thanks for your help,
Sam
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
If Session("user") Is Nothing Then
Response.Redirect("Default.aspx")
End If
If Not Page.IsPostBack Then
PopulateForm()
End If
End Sub
Private Sub dgrdParticipants_ItemDataBound(ByVal sender As System.Object,
ByVal e As DataGridItemEventArgs) Handles dgrdParticipants.ItemDataBound
'add the client side confirmation for the delete link
If e.Item.ItemType <> ListItemType.Header AndAlso e.Item.ItemType <>
ListItemType.Footer AndAlso e.Item.ItemType <> ListItemType.EditItem Then
Dim deleteButton As LinkButton =
e.Item.Cells(6).FindControl("lnkDeleteParticipant")
Dim oParticipant As cParticipant = e.Item.DataItem
deleteButton.Attributes("onclick") = "javascript:return confirm('Delete " &
oparticipant.Forename & " " & oparticipant.Surname & "?')"
End If
'load the combo boxes
'if the row is the one being edited
If e.Item.ItemType = ListItemType.EditItem Then
Dim oParticipant As cParticipant = e.Item.DataItem
Dim cboGender As DropDownList = e.Item.Cells(3).Controls(1)
cboGender = LoadGenders(cboGender, oParticipant.GenderID)
Dim cboTicketType As DropDownList = e.Item.Cells(5).Controls(1)
cboTicketType = LoadTicketTypes(cboTicketType, oParticipant.TicketTypeID)
End If
'if the row is the footer
If e.Item.ItemType = ListItemType.Footer Then
Dim cboTicketType As DropDownList = e.Item.Cells(5).Controls(1)
cboTicketType = LoadTicketTypes(cboTicketType)
Dim cboGender As DropDownList = e.Item.Cells(3).Controls(1)
cboGender = LoadGenders(cboGender)
End If
End Sub
Private Function LoadTicketTypes(ByVal cboTicketType As DropDownList,
Optional ByVal currentValue As Int32 = -1) As DropDownList
Dim oTicketType As cTicketType
Dim liItem As ListItem
For Each oTicketType In cTicketTypes.CreateNew(Session("group").Camp)
liItem = New ListItem
liItem.Text = oTicketType.ToString
liItem.Value = oTicketType.ID.ToString
cboTicketType.Items.Add(liItem)
Next
cboTicketType.ID = "cboTicketType"
SetDropDownSelected(cboTicketType, currentValue)
Return cboTicketType
End Function
Private Sub SetDropDownSelected(ByVal ddl As DropDownList, ByVal value As
String)
Dim li As ListItem
li = ddl.Items.FindByValue(value)
If Not li Is Nothing Then
ddl.SelectedIndex = ddl.Items.IndexOf(li)
End If
End Sub