This is a migrated thread and some comments may be shown as answers.
Radcombobox inside a GridView. DOesn't hit ItemsRequested
1 Answer 10 Views
This is a migrated thread and some comments may be shown as answers.
David
Top achievements
Rank 1
David asked on 16 Sep 2013, 04:23 PM
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

1 Answer, 1 is accepted

Sort by
0
David
Top achievements
Rank 1
answered on 17 Sep 2013, 09:43 AM
i found the answer:

I set the OnItemsRequested in the aspx page like so:
OnItemsRequested="cmbDispenseSizeAdd_ItemsRequested" 

and remove the Delegate in the rowDataBound
Asked by
David
Top achievements
Rank 1
Answers by
David
Top achievements
Rank 1
Share this question
or