Problem with RadCombobox ItemRequest Event in Radgrid

1 posts, 0 answers
  1. Lokesh
    Lokesh avatar
    89 posts
    Member since:
    Jul 2012

    Posted 09 Sep 2011 Link to this post

    Hi Team,
    I have a radgrid with a radcombobox in EditItemTemplate.
    When for the first time I click the mouse on RadCombo, ItemRequest event fires and shows me tha data.
    But when I input the Text in it, it doesnt fire the event again.

    This is my aspx :
    <telerik:RadGrid ID="rgCSTaskComponents" runat="server" 
                OnNeedDataSource="rgCSTaskComponents_NeedDataSource"
                OnInsertCommand="rgCSTaskComponents_InsertCommand"
                OnUpdateCommand="rgCSTaskComponents_UpdateCommand"
                OnDeleteCommand="rgCSTaskComponents_DeleteCommand"
                OnItemCommand="rgCSTaskComponents_ItemCommand"
                OnItemDataBound="rgCSTaskComponents_OnItemDataBound"
                OnItemCreated="rgCSTaskComponents_ItemCreated"
                AutoGenerateColumns="False" PageSize="15" AllowFilteringByColumn="true"
                PagerStyle-AlwaysVisible="true" PagerStyle-Mode="NextPrevAndNumeric">
               <MasterTableView  AutoGenerateColumns="False" DataKeyNames="CSTaskComponentID" DataMember="CSTaskComponents"
                                CommandItemDisplay="Top">
                 <ExpandCollapseColumn Visible="False">
                    <HeaderStyle Width="20px" />
                 </ExpandCollapseColumn>
                 <EditFormSettings>
                     <EditColumn UniqueName="EditCommandColumn">
                    </EditColumn>
                </EditFormSettings>
                <Columns>
                <telerik:GridTemplateColumn HeaderText="Part Item" UniqueName="PartItem"  DataField="DisplayName"
                          DataType="System.String"  AutoPostBackOnFilter="true" CurrentFilterFunction="Contains"
                                                             FilterControlWidth="80%">
                        <ItemTemplate>
                            <asp:Label ID="lbl_DisplayName" runat="server" Text='<%# DataBinder.Eval(Container.DataItem, "DisplayName")%>'>
                            </asp:Label>
                        </ItemTemplate>                   
                        <EditItemTemplate>
                                 <telerik:RadComboBox ID="rcbSKU" runat="server"
                                                 AutoPostBack="true"
                                                 Width="180px"
                                                 MarkFirstMatch="true"
                                                 DataTextField="DisplayName"
                                                 DataValueField="PartItemID"
                                                 OnItemsRequested="rcbSKU_ItemsRequested"
                                                 EnableLoadOnDemand="true"
                                                 ShowMoreResultsBox="true"
                                                 ItemRequestTimeout="5"
                                                 AllowCustomText="true" >
                               </telerik:RadComboBox>   
                        </EditItemTemplate>
                        <HeaderStyle HorizontalAlign="Left" Width="40%" />
                        <ItemStyle HorizontalAlign="Left" Width="40%" />                   
                    </telerik:GridTemplateColumn>          
             
            </Columns>
                    </MasterTableView>
                </telerik:RadGrid>

    and this is my cs side :
    protected void rcbSKU_ItemsRequested(object o, RadComboBoxItemsRequestedEventArgs e)
          {
              LoadSKUForDropDown();
              //RadComboBox rcbSKU = rgCSTaskComponents.MasterTableView.Items[0].FindControl("rcbSKU") as RadComboBox;
              RadComboBox rcbSKU = (RadComboBox)o;
              rcbSKU.Items.Clear();
              string text = e.Text;
     
              try
              {
                  DataRow[] rows = mSKUDataTable.Select("DisplayName LIKE '" + text + "*'", "DisplayName");
     
                  int itemsPerRequest = 10;
                  int itemOffset = e.NumberOfItems;
                  int endOffset = itemOffset + itemsPerRequest;
                  if (endOffset > rows.Length)
                  {
                      endOffset = rows.Length;
                  }
     
                  for (int i = itemOffset; i < endOffset; i++)
                  {
                      rcbSKU.Items.Add(new RadComboBoxItem(rows[i]["DisplayName"].ToString(), rows[i]["PartItemID"].ToString()));
                  }
                  if (rows.Length > 0)
                  {
                      e.Message = String.Format("Items <b>1</b>-<b>{0}</b> out of <b>{1}</b>", endOffset.ToString(), rows.Length.ToString());
                  }
                  else
                  {
                      e.Message = "No matches";
                  }
              }
              catch (Exception ex)
              {
                  ex.Source = this.AppRelativeVirtualPath;
                  e.Message = "No matches";
              }
          }

    Waiting for your positive and quick reply,
    Regards,
    Lok..

Back to Top