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

OnSelectedIndexChanged no firing

2 Answers 63 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
Rhys
Top achievements
Rank 1
Rhys asked on 19 Jun 2010, 07:14 AM
Hello all,

  I have a combo box in a form view.  I want to have an event fire when the users selects an item.  I have coded it but I am not getting any joy.  I am usingthe same process that I have used in the past on a normal DDL.  Please help

FormView

<InsertItemTemplate> 
                        <table style="width: 100%;">  
                            <tr> 
                                <td class="MasterFilesLableCells"><asp:Label ID="ItemCodeLabel" runat="server" meta:resourcekey="ItemCodeLabel" /></td>  
                                <td class="MasterFilesDataCells">  
                                    <telerik:RadComboBox ID="ItemCodeRadComboBox" Runat="server"   
                                                         DataSourceID="objDsItemNames"   
                                                         DataTextField="ItemCode"   
                                                         DataValueField="ItemId"   
                                                         AppendDataBoundItems="True" 
                                                         OnSelectedIndexChanged="ItemCodeRadComboBox_SelectedIndexChanged">     
                                        <Items> 
                                            <telerik:RadComboBoxItem runat="server" Selected="True" text="Select An Item" Value="-1" /> 
                                        </Items> 
                                    </telerik:RadComboBox> 
                                </td> 
                            </tr> 
                            <tr> 
                                <td class="MasterFilesLableCells"><asp:Label ID="PrintroomNamesLabel" runat="server" meta:resourcekey="PrintroomNamesLabel" /></td>  
                                <td class="MasterFilesDataCells"><uc2:PrintroomNames ID="PrintroomNames1" runat="server" SelectedValue='<%# Bind("PrintRoomName") %>'  /></td>  
                            </tr> 
                            <tr> 
                                <td class="MasterFilesLableCells"><asp:Label ID="ItemCostLabel" runat="server" meta:resourcekey="ItemCostLabel" /></td>  
                                  
                                <td class="MasterFilesDataCells">  
                                    <asp:Label ID="LabelItemCost" runat="server" Text='<%# Bind("ItemCost") %>' /> 
                                </td> 
                            </tr> 
                             <tr> 
                                <td colspan="2">  
                                    <asp:RadioButton ID="RadioButtonAdjustUp" runat="server" Text="Adjust Up" GroupName="AdjustDirection" Checked='<%# Bind("AdjustDirectionUp") %>' /> 
                                    <asp:RadioButton ID="RadioButtonAdjustDown" runat="server" Text="Adjust Down" GroupName="AdjustDirection" Checked='<%# Bind("AdjustDirectionDown") %>' /> 
                                 </td> 
                            </tr> 
                            <tr> 
                                 <td class="MasterFilesLableCells"><asp:Label ID="AdjustmentAmountLabel" runat="server" meta:resourcekey="AdjustmentAmountLabel" /></td>  
                                <td><telerik:RadTextBox ID="AdjustmentAmountTextBox" runat="server" Text='<%# Bind("AdjustmentAmount") %>'  Skin="Windows7" /></td>  
                            </tr> 
                            <tr> 
                                <td class="MasterFilesLableCells"><asp:Label ID="AdjustmentDateLabel" runat="server" meta:resourcekey="AdjustmentDateLabel" /></td>  
                                <td class="MasterFilesDataCells">  
                                    <telerik:RadDatePicker ID="AdjustmentDateLabelRadDatePicker" runat="server" SelectedDate='<%# Bind("AdjustmentDate") %>' > 
                                    </telerik:RadDatePicker> 
                                </td> 
                            </tr> 
                            <tr> 
                                <td colspan="2"><asp:Label ID="AdjustmentReasonLabel" runat="server" meta:resourcekey="AdjustmentReasonLabel" /></td>  
                            </tr> 
                            <tr> 
                                <td colspan="2">  
                                    <telerik:RadTextBox ID="AdjustmentReasonTextBox" runat="server" Text='<%# Bind("AdjustmentReason") %>' Rows="5" Width="450" Height="50" TextMode="MultiLine" /> 
                                </td> 
                            </tr> 
                            <tr> 
                                <td><asp:LinkButton ID="InsertButton" runat="server" CausesValidation="True" CommandName="Insert" Text="Insert" /></td>  
                                <td align="right"><asp:LinkButton ID="InsertCancelButton" runat="server" CausesValidation="False" CommandName="Cancel" Text="Cancel" /></td>  
                            </tr> 
                        </table> 
                    </InsertItemTemplate> 


Code behind

    Inherits System.Web.UI.Page  
    Dim ItemCodeRadComboBox As Telerik.Web.UI.RadComboBox = CType(FindControl("ItemCodeRadComboBox"), Telerik.Web.UI.RadComboBox)  
    Dim LabelItemCost As Label = CType(FindControl("LabelItemCost"), Label)  
 
    Protected Sub ItemCodeRadComboBox_SelectedIndexChanged(ByVal o As ObjectByVal e As Telerik.Web.UI.RadComboBoxSelectedIndexChangedEventArgs)  
        Dim ItemsAPI As New SBIS.FMSuite.Items.ItemMasterBLL  
        Dim Items As SBIS.FMSuite.Items.ItemMasterDAL.ItemsDataTable = ItemsAPI.GetItemsByItemID(ItemCodeRadComboBox.SelectedValue)  
        Dim Item As SBIS.FMSuite.Items.ItemMasterDAL.ItemsRow = Items(0)  
 
        If Item.CostingMethod = "Last cost price" Then 
            LabelItemCost.Text = Item.LastCostPrice  
        Else 
            LabelItemCost.Text = Item.AverageCostPrice  
        End If 
    End Sub 

2 Answers, 1 is accepted

Sort by
0
Yana
Telerik team
answered on 21 Jun 2010, 07:30 AM
Hello Rhys,

You should set AutoPostBack property of the combobox to true.


Best regards,
Yana
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Rhys
Top achievements
Rank 1
answered on 21 Jun 2010, 03:27 PM
Yes well maybe when my brain kicks in I will get it right, sorry for wasteing your time. :oP
Tags
ComboBox
Asked by
Rhys
Top achievements
Rank 1
Answers by
Yana
Telerik team
Rhys
Top achievements
Rank 1
Share this question
or