Problem With Itemrequested

2 posts, 0 answers
  1. Gajanan
    Gajanan  avatar
    49 posts
    Member since:
    May 2010

    Posted 09 Sep 2010 Link to this post

    Hello All,
    i have problem with Radcombobox Itemrequested,
    Actually my Radcombo is in Radgrid formtemplate on the radgrid datatbind event it is finding the radcombo but on Radcombo Itemrequested event it is not finding , my code is below.

    <MasterTableView  AutoGenerateColumns="False" DataKeyNames="OrderId" DataMember="Orders" CommandItemDisplay="Top">
                            <EditFormSettings EditFormType="Template">
                                <FormTemplate>
                                    <asp:TableCell Width="25%" HorizontalAlign="Left">                             
                                                <telerik:RadComboBox ID="RadComboBox_ShippingAddress" runat="server"
                                                DataTextField="LocationName" DataValueField="LocationID" 
                                                Width="190px" EnableLoadOnDemand="True"
                                                MarkFirstMatch="True" AllowCustomText="false"
                                                ShowMoreResultsBox="True" ItemRequestTimeout="500" AutoPostBack="false"
                                                OnItemsRequested="RadComboBox_ShippingAddress_ItemsRequested"
                                                  Height="140px"

     
    protected void RadComboBox_ShippingAddress_ItemsRequested(object o, RadComboBoxItemsRequestedEventArgs e)
        {
            LoadRadCombo_ShippingAddress();
            RadComboBox oRadComboBox_ShippingAddress = RadGrid_Orders.MasterTableView.Items[0].FindControl("RadComboBox_ShippingAddress") as RadComboBox;
             
            oRadComboBox_ShippingAddress.Items.Clear();
            string text = e.Text;
     
            try
            {
                DataRow[] rows = mShippingAddressNameListDataTable.Select("LocationName LIKE '" + text + "*'");

    in the above code on below line
    RadComboBox oRadComboBox_ShippingAddress = RadGrid_Orders.MasterTableView.Items[0].FindControl("RadComboBox_ShippingAddress") as RadComboBox;
    it is returning the NULL value and throwing exception.

    so plz tell me how to find radcombo .
  2. Yana
    Admin
    Yana avatar
    4865 posts

    Posted 09 Sep 2010 Link to this post

    Hi Gajanan ,

    You can cast the object from the parameters in ItemsRequested event handler to access the combobox:

    RadComboBox oRadComboBox_ShippingAddress = (RadComboBox) o;

    Kind 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
Back to Top