As a workaround to this thread post with no replies I'm trying to put a RadComboBox into a user control. However, the combo box data events arent being fired like the ItemCreated event. The data source is binding, but the combo box ends up empty when it loads.
The user control (I left out the javascript).
| <telerik:RadComboBox ID="RadComboBox1" Runat="server" |
| EmptyMessage="Set Team and Coach Access" AllowCustomText="true" |
| DataTextField="Person" OnClientDropDownClosed="onDropDownClosing" |
| HighlightTemplatedItems="True" ItemCreated="RadComboBox1_ItemCreated" |
| Width="214px"> |
| <ExpandAnimation Type="OutElastic" Duration="300" /> |
| <CollapseAnimation Type="InElastic" Duration="200" /> |
| <ItemTemplate> |
| <div onclick="StopPropagation(event)" class="combo-item-template"> |
| <asp:CheckBox runat="server" ID="chk1" Checked="false" onclick="onCheckBoxClick(this)"/> |
| <asp:Label runat="server" ID="Label1" AssociatedControlID="chk1" Text='<%# Eval("Person") %>'> |
| </asp:Label> |
| </div> |
| </ItemTemplate> |
| </telerik:RadComboBox> |
| <p> |
| <asp:Button ID="btnUpdate" Text='<%# (Container is GridEditFormInsertItem) ? "Insert" : "Update" %>' |
| runat="server" CommandName='<%# (Container is GridEditFormInsertItem) ? "PerformInsert" : "Update" %>'></asp:Button> |
| <asp:Button ID="btnCancel" Text="Cancel" runat="server" CausesValidation="False" CommandName="Cancel"></asp:Button> |
| </p> |
| </div> |
| <asp:XmlDataSource ID="XmlDataSource1" runat="server" OnDataBinding="BindData" |
| DataFile="~/TestDataSources/AccessList.xml"></asp:XmlDataSource> |
The user control code behind
| public void BindData(object sender, EventArgs e) |
| { |
| base.OnDataBinding(e); |
| } |
| protected void RadComboBox1_ItemCreated(object sender, RadComboBoxItemEventArgs e) |
| { |
| RadComboBoxItem newItem = e.Item; |
| if (newItem.Text == "Paris") |
| newItem.Enabled = false; |
| } |
The .net page below is what puts this user control above into a RadGrid EditFormSettings. Its connected to a master page which wraps a ContentPlaceHolder with a RadAjaxPanel.
| <telerik:RadGrid ID="RadGrid1" runat="server" |
| AllowPaging="True" AllowSorting="True" GridLines="None" |
| ShowGroupPanel="True" Width="795px" Style="margin-left:15px;" |
| DataSourceID="XmlDataSource2" AutoGenerateDeleteColumn="True" ShowStatusBar="true" |
| AutoGenerateEditColumn="True" > |
| <MasterTableView autogeneratecolumns="False" EditMode="PopUp" CommandItemDisplay="Top" |
| datasourceid="XmlDataSource2"> |
| <NoRecordsTemplate> |
| <div>No journal entries exist yet. Click "Add new record" above.</div> |
| </NoRecordsTemplate> |
| <RowIndicatorColumn> |
| <HeaderStyle Width="20px"></HeaderStyle> |
| </RowIndicatorColumn> |
| <ExpandCollapseColumn> |
| <HeaderStyle Width="20px"></HeaderStyle> |
| </ExpandCollapseColumn> |
| <commanditemsettings addnewrecordtext="Add new Journal entry" /> |
| <Columns> |
| <telerik:GridBoundColumn DataField="Title" HeaderText="Title" |
| SortExpression="Title" UniqueName="Title"> |
| </telerik:GridBoundColumn> |
| <telerik:GridBoundColumn DataField="Private" HeaderText="Private" |
| SortExpression="Private" UniqueName="Private"> |
| </telerik:GridBoundColumn> |
| <telerik:GridBoundColumn DataField="Replies" HeaderText="Replies" |
| SortExpression="Replies" UniqueName="Replies"> |
| </telerik:GridBoundColumn> |
| <telerik:GridBoundColumn DataField="Created" HeaderText="Created" |
| SortExpression="Created" UniqueName="Created"> |
| </telerik:GridBoundColumn> |
| <telerik:GridBoundColumn DataField="LastReply" HeaderText="LastReply" |
| SortExpression="LastReply" UniqueName="LastReply"> |
| </telerik:GridBoundColumn> |
| </Columns> |
| <EditFormSettings EditFormType="WebUserControl" |
| UserControlName="../../UserControls/Forms/Journal.ascx" |
| InsertCaption="New Journal Entry" PopUpSettings-Modal="true" |
| CaptionFormatString="Journal Entry On {0}" |
| CaptionDataField="Created" > |
| <EditColumn UniqueName="EditCommandColumn1"></EditColumn> |
| <PopUpSettings Modal="True"></PopUpSettings> |
| </EditFormSettings> |
| </MasterTableView> |
| <clientsettings allowdragtogroup="True"> |
| </clientsettings> |
| </telerik:RadGrid> |
So the hierarchy is
MasterPage - RadAjax Panel - ConentPlaceholder - asp.net page - RadGrid - EditForm - UserControl
MasterPage - RadAjax Panel - ConentPlaceholder - asp.net page - RadGrid - EditForm - UserControl