I've been searching, and I've not been able to make this work.
I have a RadGrid with a master table, and a detail table underneath. In each row in the detail table, I would like a column that has a dropdown list noting who that particular row is "Assigned To". I'm having trouble binding a data set to this dropdown. I've tried doing it through the "receiptItems_ItemDataBound" method, because that's where the images in the row and the PDF link to download are both bound. "childitem.FindControl("ddlAsignedTo')" is not finding anything and return a null. The data set is a session variable that is populated on Page Load, unless there is a better method to do it.
See image example here
<
telerik:RadGrid
ID
=
"rgReceipts"
runat
=
"server"
AutoGenerateColumns
=
"false"
AllowSorting
=
"True"
AllowMultiRowSelection
=
"False"
OnDetailTableDataBind
=
"rgReceipts_DetailTableDataBind"
OnNeedDataSource
=
"rgReceipts_NeedDataSource"
OnItemDataBound
=
"receiptItems_ItemDataBound"
>
<
MasterTableView
DataKeyNames
=
"JobNumber"
HierarchyLoadMode
=
"ServerBind"
HierarchyDefaultExpanded
=
"false"
CommandItemDisplay
=
"Top"
ShowHeader
=
"false"
>
<
NoRecordsTemplate
>Could not find any receipts for that user.</
NoRecordsTemplate
>
<
CommandItemSettings
ShowAddNewRecordButton
=
"False"
/>
<
DetailTables
>
<
telerik:GridTableView
DataKeyNames
=
"ReceiptID"
Name
=
"Receipts"
Width
=
"100%"
>
<
Columns
>
[...]
<
telerik:GridTemplateColumn
HeaderText
=
"Assigned To"
>
<
HeaderStyle
Width
=
"120"
Font-Bold
=
"True"
/>
<
ItemTemplate
>
<
telerik:RadDropDownList
ID
=
"ddlAsignedTo"
runat
=
"server"
MaxHeight
=
"225"
/>
</
ItemTemplate
>
</
telerik:GridTemplateColumn
>
[...]
The snippet added to "receiptItems_ItemDataBound" that has not been successful, because the "ddlAssignedTo" control apparently can't be located and returns null:
RadDropDownList ddlAssigned = (RadDropDownList) childItem.FindControl(
"ddlAssignedTo"
);
ddlAssigned.DataSource = ddlAssignedUsersList;
ddlAssigned.DataTextField =
"Text"
;
ddlAssigned.DataValueField =
"Value"
;
If more information or snippets are needed, I can provide whatever. I wasn't sure exactly what to provide that would be helpful.
asdf