This is a migrated thread and some comments may be shown as answers.

Telerik dropdown bind on index change event need good practices comments?

2 Answers 21 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Himanshu
Top achievements
Rank 1
Himanshu asked on 27 Dec 2013, 08:36 AM
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.

2 Answers, 1 is accepted

Sort by
0
Accepted
Konstantin Dikov
Telerik team
answered on 01 Jan 2014, 02:47 PM
Hi Himanshu,

The approach that you are currently using is the one that should be used, since there is no built-in functionality to support it. Also, getting reference to each of the RadComboBox controls could not be avoided and it is the only way to achieve the desired result.


Regards,
Konstantin Dikov
Telerik
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to the blog feed now.
0
Himanshu
Top achievements
Rank 1
answered on 02 Jan 2014, 08:09 AM
Thanks Konstantin.
Tags
Grid
Asked by
Himanshu
Top achievements
Rank 1
Answers by
Konstantin Dikov
Telerik team
Himanshu
Top achievements
Rank 1
Share this question
or