Hi all,
I'm sure you understand my code beneath, but how could this be done better? Not really like this "selection-hack"...
GridTemplateColumn:
The combobox items is loaded in the OnInit event, and selection done in the ItemDataBound on the RadGrid like this:
Any ideas?
Cheers, Ahrensberg
I'm sure you understand my code beneath, but how could this be done better? Not really like this "selection-hack"...
GridTemplateColumn:
| <telerik:GridTemplateColumn HeaderText="<%$ Resources:LanguageWeb, OrderLine_Paragraph %>" |
| UniqueName="ParagraphId" HeaderStyle-Width="200px"> |
| <ItemTemplate> |
| <telerik:RadComboBox runat="server" ID="CbParagraph" OnInit="CbParagraph_Init" ToolTip='<%# Bind("Paragraph.id") %>' /> |
| </ItemTemplate> |
| </telerik:GridTemplateColumn> |
The combobox items is loaded in the OnInit event, and selection done in the ItemDataBound on the RadGrid like this:
| protected void RadGrid_ItemDataBound(object sender, GridItemEventArgs e) |
| { |
| if (!(e.Item is GridDataItem)) return; |
| var gridItem = (GridDataItem)e.Item; |
| var cbParagraphControl = gridItem.FindControl("CbParagraph"); |
| if (cbParagraphControl is RadComboBox) |
| { |
| var cbParagraph = (RadComboBox) cbParagraphControl; |
| cbParagraphcbParagraph.SelectedValue = cbParagraph.ToolTip; |
| cbParagraph.ToolTip = ""; |
| } |
| } |
Any ideas?
Cheers, Ahrensberg