Radcombobox inside a GridView. DOesn't hit ItemsRequested

2 posts, 0 answers
  1. David
    David avatar
    38 posts
    Member since:
    May 2013

    Posted 16 Sep 2013 Link to this post

    i have a couple of RadComboboxs inside a GridView.
    inside the RowDataBound Event of the GridView, I am doing the following:

    Dim cmbDispenseSize As RadComboBox = CType(e.Row.FindControl("cmbDispenseSizeAdd"), RadComboBox)
    bindIngredient(CType(cmbIngredient, RadComboBox), 0) 'fill the combobox with initial data
     AddHandler cmbDispenseSize.ItemsRequested, AddressOf cmbDispense_ItemsRequested 'add handler for ItemsReqested event

    Private Sub cmbDispense_ItemsRequested(sender As Object, e As RadComboBoxItemsRequestedEventArgs)
           If Not e.Context("IngredientAddID").ToString() = "" Then
               Dim IngredientAddID As Integer = CInt(e.Context("IngredientAddID").ToString())
               ViewState("IngredientAddID") = CInt(e.Context("IngredientAddID").ToString())
               getRequestedItems(e, CType(sender, RadComboBox), 0, IngredientAddID)
           End If
       End Sub

    Private Sub getRequestedItems(ByRef e As RadComboBoxItemsRequestedEventArgs, ByRef sender As RadComboBox, ByVal cmbType As Integer, Optional ByVal IngredientID As Integer = 0)
          Dim dt As DataTable
          If cmbType = 0 Then
              dt = _recipe.getDispenseSize(_security.UserID, IngredientID, e.Text.ToUpper)
              loadRequestedItems(e, "DispenseSizeName", "DispenseSizeID", dt, sender)
          ElseIf cmbType = 1 Then
              dt = _recipe.getStockItems(_security.UserID, _security.DivisionId, _recipeId, e.Text.ToUpper)
              loadRequestedItems(e, "StockItemName", "StockItemID", dt, sender)
          End If
      End Sub

    i'm having trouble getting the ItemsRequested working. it all works fine if i run GridView.DataBind on page_load and have page_load run everytime something is typed into the combobox. unfortunately the GridView takes about 4 seconds to load, so the combobox ItemsRequested looks really slow.

    if i ont GridView.DataBind in the Page_Load - and therefore, it doesn't run everytime something is typed into the combobox - the ItemsRequested Event does not run. (no doubt due to the fact my AddHandler is inside the RowDataBond event)

    are there any examples you could show me where a RadCombobox is inside a GridView and is being created programatically within the RowDataBound event?

    thank you for your help
  2. David
    David avatar
    38 posts
    Member since:
    May 2013

    Posted 17 Sep 2013 Link to this post

    i found the answer:

    I set the OnItemsRequested in the aspx page like so:

    and remove the Delegate in the rowDataBound
Back to Top