Control in item template is not recognizing

2 posts, 0 answers
  1. Regeesh Joseph
    Regeesh Joseph avatar
    55 posts
    Member since:
    May 2010

    Posted 26 Mar 2012 Link to this post


    I have a hiddenfield in the item template of a Radcombo. I have to take the value of hiddenfield in the SelectedIndexChanged event of radcombo. I used the following method as per your website refernece for radcombo. This code was working fine. But one day it started not working, showing null reference exception in finding the hiddenfield. I didn't change anything.



    void rcbTruck_SelectedIndexChanged(object sender, Telerik.Web.UI.RadComboBoxSelectedIndexChangedEventArgs e)





    combo = (RadComboBox)sender;



    RadComboBoxItem item = (RadComboBoxItem)combo.SelectedItem;


    hidDailyOrderDetailId2.Value = ((







    asp:HiddenField ID="hidDailyOrderDetailId2" runat="server" />




    telerik:RadComboBox ID="rcbTruck" runat="server" DropDownWidth="250px" Width="250px"



    ShowToggleImage="true" Height="140px" AllowCustomText="True" MarkFirstMatch="False"



    HighlightTemplatedItems="True" TabIndex="2" EmptyMessage="--Select--" AutoPostBack="true"



    EnableLoadOnDemand="True" Skin="Web20" ToolTip="Please Select truck" MaxHeight="250px"



    OnItemsRequested="rcbTruck_ItemsRequested" OnSelectedIndexChanged="rcbTruck_SelectedIndexChanged">






    <input id="hidScheduledStartTime" type="hidden" runat="server" value='<%#DataBinder.Eval(Container.DataItem,"ScheduledTime") %>' />



    <asp:Label ID="lblVehicleName" runat="server" Text='<%#DataBinder.Eval(Container.DataItem,"VehicleName") %>'></asp:Label>



    <asp:HiddenField ID="hidDailyOrderDetailId1" runat="server" Value='<%#DataBinder.Eval(Container.DataItem,"Daily_Order_Detail_Id") %>' />








  2. Ivana
    Ivana avatar
    657 posts

    Posted 29 Mar 2012 Link to this post

    Hi Regeesh,

    This would be a valid approach to access the elements within the Item template if RadComboBox does not have the load on demand feature enabled. For more information on this matter you could refer to the following help article: [].

    To copy some value from one hidden field to another, when the selected index of RadComboBox is changed is something that can be easily implemented on the client. Here is an example:
    function OnClientSelectedIndexChanged(sender, args) {
        $get("HiddenField2").value = $get("HiddenField1").value;

    At the following link you can find more about the client API of RadComoBox: [].

    Kind regards,
    the Telerik team
    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 their blog feed now.
Back to Top