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
Code behind
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 Object, ByVal 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 |