James Kennon
Top achievements
Rank 1
James Kennon
asked on 26 Oct 2010, 11:37 PM
Hi,
I am using a RadComboBox in an EditItemTemplate of a GridTemplateColumn (in a Detail Table). How do I wire it to use the ItemsRequested event? I have tried wiring it in the RadGrid ItemDataBound event but the ItemsRequested event is never fired. I have set the EnableLoadOnDemand property to true. I am using RadGrid 5.1.1.0 .
Regards,
James
I am using a RadComboBox in an EditItemTemplate of a GridTemplateColumn (in a Detail Table). How do I wire it to use the ItemsRequested event? I have tried wiring it in the RadGrid ItemDataBound event but the ItemsRequested event is never fired. I have set the EnableLoadOnDemand property to true. I am using RadGrid 5.1.1.0 .
Regards,
James
RadComboBox combo2 = (RadComboBox)e.Item.FindControl("RadComboBox2");
combo2.ItemsRequested += this.list_ItemsRequested;
RadComboBox combo2 = (RadComboBox)e.Item.FindControl("RadComboBox2");
combo2.ItemsRequested += this.list_ItemsRequested;
<EditItemTemplate>
<telerik:RadComboBox ID="RadComboBox2" AppendDataBoundItems="true" Height="200px" runat="server" Skin="WebBlue"
DataTextField="Temp" DropDownWidth="400px" DataValueField="Code" AllowCustomText="true" MarkFirstMatch="false"
SelectedValue='<%# Bind("SAPCode")%>' Sort="Ascending" Filter="Contains" HighlightTemplatedItems="True" EnableLoadOnDemand="true">
<EditItemTemplate>
<telerik:RadComboBox ID="RadComboBox2" AppendDataBoundItems="true" Height="200px" runat="server" Skin="WebBlue"
DataTextField="Temp" DropDownWidth="400px" DataValueField="Code" AllowCustomText="true" MarkFirstMatch="false"
<telerik:GridTemplateColumn HeaderText="SAP Code" UniqueName="SAPCode">
<HeaderTemplate>
<table style="font-size:11px">
<tr>
<td style="width: 100px;">Code</td>
<td style="width: 200px;">Info</td>
</tr>
</table>
</HeaderTemplate>
<EditItemTemplate>
<telerik:RadComboBox ID="RadComboBox2" AppendDataBoundItems="true" Height="200px" runat="server" Skin="WebBlue"
DataTextField="Temp" DropDownWidth="400px" DataValueField="Code" AllowCustomText="true" MarkFirstMatch="false"
SelectedValue='<%# Bind("SAPCode")%>' Sort="Ascending" Filter="Contains" HighlightTemplatedItems="True" EnableLoadOnDemand="true">
3 Answers, 1 is accepted
0
Princy
Top achievements
Rank 2
answered on 27 Oct 2010, 06:16 AM
Hello James,
Try to attach ItemRequested event to RadComboBox in ItemCreated event of RadGrid .
ASPX:
C#:
Thanks,
Princy.
Try to attach ItemRequested event to RadComboBox in ItemCreated event of RadGrid .
ASPX:
<DetailTables> <telerik:GridTableView Name="GridTableView1" runat="server"> <Columns> <telerik:GridTemplateColumn> <EditItemTemplate> <telerik:RadComboBox ID="RadComboBox1" runat="server"></telerik:RadComboBox> </EditItemTemplate> </telerik:GridTemplateColumn> </Columns> . . . . . . . . </DetailTables>C#:
protected void RadGrid1_ItemCreated(object sender, GridItemEventArgs e) { if (e.Item is GridEditFormItem && e.Item.IsInEditMode && e.Item.OwnerTableView.Name == "GridTableView1") // check with Name of DetailTable { GridEditFormItem editItem = (GridEditFormItem)e.Item; RadComboBox combo = (RadComboBox)editItem.FindControl("RadComboBox1"); combo.EnableLoadOnDemand = true; combo.AutoPostBack = true; combo.ItemsRequested += new RadComboBoxItemsRequestedEventHandler(combo_ItemsRequested); } } protected void combo_ItemsRequested(object o, RadComboBoxItemsRequestedEventArgs e) { }Thanks,
Princy.
0
James Kennon
Top achievements
Rank 1
answered on 27 Oct 2010, 11:56 PM
Hi,
Sorry,I probably should have mentioned that I am doing "InPlace" editing for the grid. There is never any item returned to RadGrid1_ItemCreated that IsInEditMode is true for or with the correct OwnerTableView name and of course no EditFormItem.
Regards,
Ian
Sorry,I probably should have mentioned that I am doing "InPlace" editing for the grid. There is never any item returned to RadGrid1_ItemCreated that IsInEditMode is true for or with the correct OwnerTableView name and of course no EditFormItem.
Regards,
Ian
0
Princy
Top achievements
Rank 2
answered on 28 Oct 2010, 08:05 AM
Hello James,
If you are using 'InPlace' EditMode for DetailTable , make the following changes in the above code.
C#:
Thanks,
Princy.
If you are using 'InPlace' EditMode for DetailTable , make the following changes in the above code.
C#:
protected void RadGrid1_ItemCreated(object sender, GridItemEventArgs e) { if (e.Item is GridEditableItem && e.Item.IsInEditMode && e.Item.OwnerTableView.Name == "GridTableView1") { GridEditableItem editItem = (GridEditableItem)e.Item; RadComboBox combo = (RadComboBox)editItem.FindControl("RadComboBox1"); combo.EnableLoadOnDemand = true; combo.AutoPostBack = true; combo.ItemsRequested += new RadComboBoxItemsRequestedEventHandler(combo_ItemsRequested); } }Thanks,
Princy.