G
Guest
Can someone please tell my why the following doesn't work!
I don't get any errors on the page but when I choose a value from the
dropdownlist what is ment to happen is that a user control should be loaded
into
the page!
However I don't get any reaction what so ever!
Please see comments below!
Thanks
... code
' loads contol according to the value given to NoMobilePhones()
Public Sub NoMobilePhones(ByVal v_intNoMobilePhoneNumbers As Integer)
Dim iCounter As Integer
If v_intNoMobilePhoneNumbers <> 0 Then
For iCounter = 1 To v_intNoMobilePhoneNumbers
Dim c1 As Control = LoadControl("AddMob.ascx")
AddHere.Controls.Add(c1)
Next
End If
End Sub
'Populates the dropdownlist with numbers 1 - 10
Public Sub PopulateDDLNoMobAccounts()
'assuming you have a button named ForLoop
Dim i As Integer
For i = 1 To 10
v_intNoMobilePhoneNumbers.Items.Add(New ListItem(i.ToString(),
i.ToString()))
Next i
' Adds a "select one" to the dropdownlist
v_intNoMobilePhoneNumbers.Items.Insert(0, New ListItem("Select One",
"0"))
v_intNoMobilePhoneNumbers.SelectedIndex = 0
' This should provide a value to the sub NoMobilePhones()
If i <> 0 Then
Dim NoAccounts As Integer
NoAccounts = CType(v_intNoMobilePhoneNumbers.SelectedItem.Value,
Integer)
If NoAccounts = 0 Then
lblMobPhone.Text = "Please choose number of Mobile Accounts"
Else
NoMobilePhones(NoAccounts)
End If
End If
End Sub
I don't get any errors on the page but when I choose a value from the
dropdownlist what is ment to happen is that a user control should be loaded
into
the page!
However I don't get any reaction what so ever!
Please see comments below!
Thanks
... code
' loads contol according to the value given to NoMobilePhones()
Public Sub NoMobilePhones(ByVal v_intNoMobilePhoneNumbers As Integer)
Dim iCounter As Integer
If v_intNoMobilePhoneNumbers <> 0 Then
For iCounter = 1 To v_intNoMobilePhoneNumbers
Dim c1 As Control = LoadControl("AddMob.ascx")
AddHere.Controls.Add(c1)
Next
End If
End Sub
'Populates the dropdownlist with numbers 1 - 10
Public Sub PopulateDDLNoMobAccounts()
'assuming you have a button named ForLoop
Dim i As Integer
For i = 1 To 10
v_intNoMobilePhoneNumbers.Items.Add(New ListItem(i.ToString(),
i.ToString()))
Next i
' Adds a "select one" to the dropdownlist
v_intNoMobilePhoneNumbers.Items.Insert(0, New ListItem("Select One",
"0"))
v_intNoMobilePhoneNumbers.SelectedIndex = 0
' This should provide a value to the sub NoMobilePhones()
If i <> 0 Then
Dim NoAccounts As Integer
NoAccounts = CType(v_intNoMobilePhoneNumbers.SelectedItem.Value,
Integer)
If NoAccounts = 0 Then
lblMobPhone.Text = "Please choose number of Mobile Accounts"
Else
NoMobilePhones(NoAccounts)
End If
End If
End Sub