Hello All,
Hopefully this has an easy solution. I'm using a RadGrid with an EditForm (EditFormType="Template"). In that form I have a dropdownlist and several other fields. Depending on the value selected in the ddl, I need to enable or disable certain validators. the following code for SelectedIndexChanged works when in edit mode, but does not when in insert mode. How do I get it to fire for Insert as well as Edit?
Protected Sub lstContactType_SelectedIndexChanged(sender As Object, e As EventArgs)
For Each item As GridDataItem In gridEmpContacts.EditItems
' Access your textbox here
Dim rfv1 As RequiredFieldValidator = TryCast(item.EditFormItem.FindControl("rfvSSN"), RequiredFieldValidator)
Dim rfv2 As RequiredFieldValidator = TryCast(item.EditFormItem.FindControl("rfvPctBene"), RequiredFieldValidator)
Dim rfv3 As RequiredFieldValidator = TryCast(item.EditFormItem.FindControl("rfvContactDoB"), RequiredFieldValidator)
Dim listbox As DropDownList = DirectCast(sender, DropDownList)
Select Case listbox.SelectedValue
Case "401K/Profitsharing - Primary", "401K/Profitsharing - Secondary", "Life - Primary", "Life - Secondary", "AD&D - Primary", "AD&D - Secondary"
rfv1.Enabled = True
rfv2.Enabled = True
rfv3.Enabled = True
Case Else
rfv1.Enabled = False
rfv2.Enabled = False
rfv3.Enabled = False
End Select
Next
End Sub