I'm using a RadGrid with an edit form template and I'm trying to replicate the Related ComboBoxes example within this template. Implementing the example outside of the template was simple enough, but now I'm having difficulty working within the edit form template. Specifically, I'm having trouble drilling down (via JQuery) and obtaining references to the pair of comboboxes for the item currently being editted. Any insight on how to go about doing this?
Here are my scripts:
Here is the RadGrid:
All of this is placed within an .ascx file.
Here are my scripts:
<script type=
"text/javascript"
>
// This part needs to change
function
pageLoad() {
unitsCombo = $find(
"<%= Unit_ComboBox.ClientID %>"
);
groupsCombo = $find(
"<%= Group_ComboBox.ClientID %>"
);
}
function
PopulateGroups(combo, eventArgs) {
var
item = eventArgs.get_item();
groupsCombo.set_text(
"Loading..."
);
if
(item.get_index() > 0) {
groupsCombo.requestItems(item.get_value(),
false
);
}
else
{
groupsCombo.set_text(
" "
);
groupsCombo.clearItems();
}
}
function
ItemsPopulated(combo, eventArgs) {
if
(combo.get_items().get_count() > 0) {
combo.set_text(combo.get_items().getItem(0).get_text());
combo.get_items().getItem(0).highlight();
}
combo.showDropDown();
}
</script>
Here is the RadGrid:
<
telerik:RadGrid
ID
=
"OrganizerItemDisplay_Grid"
runat
=
"server"
BorderStyle
=
"None"
Skin
=
"Black"
OnNeedDataSource
=
"OrganizerItemDisplay_Grid_NeedDataSource"
OnItemDataBound
=
"OrganizerItemDisplay_Grid_ItemDataBound"
>
<
MasterTableView
AllowPaging
=
"false"
AllowSorting
=
"false"
AutoGenerateColumns
=
"false"
EditFormSettings-EditFormType
=
"Template"
PagerStyle-Visible
=
"true"
CommandItemDisplay
=
"Top"
CommandItemSettings-AddNewRecordText
=
"Add New Organizer"
CommandItemSettings-ShowAddNewRecordButton
=
"true"
>
<
NoRecordsTemplate
>
<
div
style
=
"margin:0 auto; padding: 5px; width:100%"
>
<
asp:Label
ID
=
"NoRecords_Label"
runat
=
"server"
Text
=
"There are no organizers on record."
/>
</
div
>
</
NoRecordsTemplate
>
<
EditFormSettings
>
<
FormTemplate
>
<
ul
>
<
li
>
<
asp:Label
runat
=
"server"
ID
=
"Name_Label"
AssociatedControlID
=
"Name_TextBox"
Text
=
"Name"
/>
<
telerik:RadTextBox
runat
=
"server"
ID
=
"Name_TextBox"
Width
=
"200px"
/>
</
li
>
<
li
>
<
asp:Label
runat
=
"server"
ID
=
"NetId_Label"
AssociatedControlID
=
"NetId_TextBox"
Text
=
"NetID"
/>
<
telerik:RadTextBox
runat
=
"server"
ID
=
"NetId_TextBox"
Width
=
"200px"
/>
</
li
>
<
li
>
<
asp:Label
runat
=
"server"
ID
=
"Phone_Label"
AssociatedControlID
=
"Phone_TextBox"
Text
=
"Phone"
/>
<
telerik:RadTextBox
runat
=
"server"
ID
=
"Phone_TextBox"
Width
=
"200px"
/>
</
li
>
<
li
>
<
asp:Label
runat
=
"server"
ID
=
"Role_Label"
AssociatedControlID
=
"Role_ComboBox"
Text
=
"Role"
/>
<
telerik:RadComboBox
ID
=
"Role_ComboBox"
runat
=
"server"
OnItemDataBound
=
"Role_ComboBox_ItemDataBound"
Width
=
"204px"
/>
</
li
>
<
li
>
<
asp:Label
runat
=
"server"
ID
=
"Unit_Label"
AssociatedControlID
=
"Unit_ComboBox"
Text
=
"Unit"
/>
<
telerik:RadComboBox
ID
=
"Unit_ComboBox"
runat
=
"server"
OnClientSelectedIndexChanging
=
"PopulateGroups"
OnItemsRequested
=
"Unit_ComboBox_ItemsRequested"
OnItemDataBound
=
"Unit_ComboBox_ItemDataBound"
Width
=
"204px"
/>
</
li
>
<
li
>
<
asp:Label
runat
=
"server"
ID
=
"Group_Label"
AssociatedControlID
=
"Group_ComboBox"
Text
=
"Group"
/>
<
telerik:RadComboBox
ID
=
"Group_ComboBox"
runat
=
"server"
OnClientItemsRequested
=
"ItemsPopulated"
OnItemsRequested
=
"Group_ComboBox_ItemsRequested"
OnItemDataBound
=
"Group_ComboBox_ItemDataBound"
Width
=
"204px"
/>
</
li
>
<
li
>
<
asp:Label
runat
=
"server"
ID
=
"Email_Label"
AssociatedControlID
=
"Email_TextBox"
Text
=
"Email"
/>
<
telerik:RadTextBox
runat
=
"server"
ID
=
"Email_TextBox"
Width
=
"200px"
/>
</
li
>
</
ul
>
<
asp:Button
ID
=
"ViewProgram_UpdateAudience_Button"
Text='<%# (Container is GridEditFormInsertItem) ? "Insert" : "Update" %>' runat="server" CommandName='<%# (Container is GridEditFormInsertItem) ? "PerformInsert" : "Update" %>' />
<
asp:Button
ID
=
"CancelEdit_Button"
Text
=
"Cancel"
runat
=
"server"
CausesValidation
=
"False"
CommandName
=
"Cancel"
/>
</
FormTemplate
>
</
EditFormSettings
>
<
Columns
>
<
telerik:GridBoundColumn
DataField
=
"NAME"
HeaderText
=
"Name"
UniqueName
=
"Name"
/>
<
telerik:GridBoundColumn
DataField
=
"ORGANIZERROLE"
HeaderText
=
"Role"
UniqueName
=
"Role"
/>
<
telerik:GridBoundColumn
DataField
=
"ORGANIZERGROUP"
HeaderText
=
"Group"
UniqueName
=
"Group"
/>
<
telerik:GridButtonColumn
ConfirmTitle
=
"Remove Organizer"
ConfirmText
=
"Are you sure you want to remove this organizer?"
ConfirmDialogType
=
"RadWindow"
ButtonType
=
"ImageButton"
ImageUrl
=
"~/Common/Images/Toolbar/toolbar_delete_small.gif"
Text
=
"Remove Organizer"
CommandName
=
"DELETE"
UniqueName
=
"DeleteCommandColumn"
/>
<
telerik:GridEditCommandColumn
ButtonType
=
"ImageButton"
UniqueName
=
"EditCommandColumn"
/>
</
Columns
>
</
MasterTableView
>
</
telerik:RadGrid
>
All of this is placed within an .ascx file.