I have a telerik drop down box inside a Telerik grid's edit form. When user change the value of a dropdown i called server side event and binds/sets others dropdowns as below code:
Protected Sub RdCmbTpcType_IndexChanged _
(ByVal sender As Object, ByVal e As RadComboBoxSelectedIndexChangedEventArgs)
Dim ddlTpcType As RadComboBox = DirectCast(sender, RadComboBox)
Dim editItem As GridEditableItem = DirectCast(ddlTpcType.NamingContainer, _
GridEditableItem)
Dim ddlTpcInvoiceItemLevel As RadComboBox = _
DirectCast(editItem.FindControl("rdcmbTPCInvoiceItemLevel"), RadComboBox)
Dim ddlTpcRateType As RadComboBox = _
DirectCast(editItem.FindControl("rdcmbTPCRateType"), RadComboBox)
Dim ddlTpcFeeCode As RadComboBox = DirectCast(editItem.FindControl _
("rdcmbTPCFeeCode"), RadComboBox)
If (ddlTpcType.SelectedValue = CommissionTypes.Premium) Then
BindDropDown(ddlTpcInvoiceItemLevel, ReturnPremiumsView, _
"InvoiceItemLevel", "InvoiceItemID")
ddlTpcFeeCode.Enabled = False
ElseIf (ddlTpcType.SelectedValue = CommissionTypes.Fee) Then
BindDropDown(ddlTpcInvoiceItemLevel, ReturnFeesView, _
"InvoiceItemLevel", "InvoiceItemID")
BindTpcFeeCode(editItem)
ddlTpcFeeCode.Enabled = True
Else
ddlTpcRateType.SelectedValue = 0
End If
EnableDisablePaging("TPCClassToHidePageSelector", "TPCClassToHidePageResizer", "true")
End Sub
So my question is like i want to minimize this method by using any inbuilt/custom ways which can be provided by Telerik or do i have to directcast all control and do code like above for all these type of events?
Any suggestion will be helpful.
Protected Sub RdCmbTpcType_IndexChanged _
(ByVal sender As Object, ByVal e As RadComboBoxSelectedIndexChangedEventArgs)
Dim ddlTpcType As RadComboBox = DirectCast(sender, RadComboBox)
Dim editItem As GridEditableItem = DirectCast(ddlTpcType.NamingContainer, _
GridEditableItem)
Dim ddlTpcInvoiceItemLevel As RadComboBox = _
DirectCast(editItem.FindControl("rdcmbTPCInvoiceItemLevel"), RadComboBox)
Dim ddlTpcRateType As RadComboBox = _
DirectCast(editItem.FindControl("rdcmbTPCRateType"), RadComboBox)
Dim ddlTpcFeeCode As RadComboBox = DirectCast(editItem.FindControl _
("rdcmbTPCFeeCode"), RadComboBox)
If (ddlTpcType.SelectedValue = CommissionTypes.Premium) Then
BindDropDown(ddlTpcInvoiceItemLevel, ReturnPremiumsView, _
"InvoiceItemLevel", "InvoiceItemID")
ddlTpcFeeCode.Enabled = False
ElseIf (ddlTpcType.SelectedValue = CommissionTypes.Fee) Then
BindDropDown(ddlTpcInvoiceItemLevel, ReturnFeesView, _
"InvoiceItemLevel", "InvoiceItemID")
BindTpcFeeCode(editItem)
ddlTpcFeeCode.Enabled = True
Else
ddlTpcRateType.SelectedValue = 0
End If
EnableDisablePaging("TPCClassToHidePageSelector", "TPCClassToHidePageResizer", "true")
End Sub
So my question is like i want to minimize this method by using any inbuilt/custom ways which can be provided by Telerik or do i have to directcast all control and do code like above for all these type of events?
Any suggestion will be helpful.