I have a grid with a master and detail table. The master table has several rows. When I click a row to expand the detail table, in the ItemDataBound Event I have some code that populates a dropdown in the detail table, as below
The contents of the drop down are determined by 2 values, a 'type' which is a drop down on the main page, and 'genre' which is a column in the master table in the grid. After searching the forums, the only method I could find to obtain this value from the master table is by using a hashtable, like so
After stepping through the code, the hash table is always empty (its count is zero), yet the master table has data. How Can I obtain the data I need from the selected row in the master table ?? Is there another way ?
| if ("ArtistCategories".Equals(e.Item.OwnerTableView.Name)) |
| { |
| if (e.Item is GridEditableItem && e.Item.IsInEditMode) |
| { |
| GridDataItem dataitem = e.Item.OwnerTableView.ParentItem; |
| Hashtable values = new Hashtable(); |
| dataitem.ExtractValues(values); |
| object Objgenre = values["Genre"]; |
| GridEditableItem _item = (GridEditableItem)e.Item; |
| Telerik.Web.UI.RadComboBox cb = (Telerik.Web.UI.RadComboBox)_item["ArtistCategory"].FindControl("RadComboBoxCategories"); |
| string genre = Objgenre.ToString(); |
| cb.DataSource = lookupmanager.CategoryByGenre(genre, this.RadComboBoxType.SelectedValue); |
| cb.DataTextField = "Category"; |
| cb.DataValueField = "Category"; |
| cb.DataBind(); |
| try |
| { |
| Studio1DBObjects.SecondaryCategory sg = (Studio1DBObjects.SecondaryCategory)e.Item.DataItem; |
| string category = sg.Category; |
| int index = cb.FindItemIndexByValue(category); |
| cb.SelectedIndex = index; |
| } |
| catch (Exception ex) |
| { |
| // |
| } |
| } |
| } |
The contents of the drop down are determined by 2 values, a 'type' which is a drop down on the main page, and 'genre' which is a column in the master table in the grid. After searching the forums, the only method I could find to obtain this value from the master table is by using a hashtable, like so
| Hashtable values = new Hashtable(); |
| dataitem.ExtractValues(values); |
| object Objgenre = values["Genre"]; |
After stepping through the code, the hash table is always empty (its count is zero), yet the master table has data. How Can I obtain the data I need from the selected row in the master table ?? Is there another way ?