Hello,
I thought this would be straight-forward, and maybe it is -- I am probably missing something obvious. I have a RadGrid that has DropDownList inside a GridTemplateColumn.
<
telerik:RadGrid
ID
=
"RadGridTestsInstruments"
runat
=
"server"
DataSourceID
=
"SqlDataSourceTestsInstruments"
AutoGenerateColumns
=
"False"
AllowSorting
=
"True"
Height
=
"220px"
Width
=
"430px"
AllowMultiRowSelection
=
"false"
AllowAutomaticUpdates
=
"True"
OnItemUpdated
=
"RadGridTestsInstruments_ItemUpdated"
style
=
"margin-top: 0px"
>
<
GroupingSettings
CollapseAllTooltip
=
"Collapse all groups"
></
GroupingSettings
>
<
ClientSettings
AllowKeyboardNavigation
=
"true"
EnableRowHoverStyle
=
"true"
>
<
Selecting
AllowRowSelect
=
"true"
></
Selecting
>
<
Scrolling
AllowScroll
=
"True"
UseStaticHeaders
=
"True"
/>
</
ClientSettings
>
<
MasterTableView
DataSourceID
=
"SqlDataSourceTestsInstruments"
DataKeyNames
=
"set_test_id,test_id"
EditMode
=
"Batch"
>
<
BatchEditingSettings
EditType
=
"Cell"
/>
<
Columns
>
<
telerik:GridBoundColumn
DataField
=
"set_test_id"
HeaderText
=
"set_test_id"
SortExpression
=
"set_test_id"
UniqueName
=
"set_test_id"
DataType
=
"System.Int32"
ReadOnly
=
"True"
Display
=
"False"
>
</
telerik:GridBoundColumn
>
<
telerik:GridBoundColumn
DataField
=
"test_id"
DataType
=
"System.Int32"
HeaderText
=
"test_id"
ReadOnly
=
"True"
SortExpression
=
"test_id"
UniqueName
=
"test_id"
Display
=
"False"
>
</
telerik:GridBoundColumn
>
<
telerik:GridBoundColumn
DataField
=
"grid_instrument_id"
DataType
=
"System.Int32"
HeaderText
=
"grid_instrument_id"
ReadOnly
=
"True"
SortExpression
=
"grid_instrument_id"
UniqueName
=
"grid_instrument_id"
Display
=
"False"
>
</
telerik:GridBoundColumn
>
<
telerik:GridBoundColumn
DataField
=
"test"
HeaderText
=
"Test"
SortExpression
=
"test"
UniqueName
=
"test"
ReadOnly
=
"True"
>
</
telerik:GridBoundColumn
>
<
telerik:GridTemplateColumn
HeaderText
=
"Instrument"
HeaderStyle-Width
=
"110px"
UniqueName
=
"instrument_id"
DataField
=
"instrument_id"
AllowFiltering
=
"false"
>
<
ItemTemplate
>
<%# Eval("instrument") %>
</
ItemTemplate
>
<
EditItemTemplate
>
<
telerik:RadDropDownList
RenderMode
=
"Lightweight"
runat
=
"server"
ID
=
"RadDropDownListInstruments"
DataField
=
"set_test_id"
DataValueField
=
"instrument_id"
DataTextField
=
"instrument"
AllowCustomText
=
"true"
EmptyMessage
=
"Choose Instrument"
DataSourceID
=
"SqlDataSourceInstruments"
Width
=
"100px"
>
</
telerik:RadDropDownList
>
</
EditItemTemplate
>
</
telerik:GridTemplateColumn
>
<
telerik:GridBoundColumn
DataField
=
"workflow_id"
DataType
=
"System.Int32"
HeaderText
=
"workflow_id"
ReadOnly
=
"True"
UniqueName
=
"workflow_id"
Display
=
"False"
>
</
telerik:GridBoundColumn
>
<
telerik:GridBoundColumn
DataField
=
"workflow"
HeaderText
=
"Workflow"
SortExpression
=
"workflow"
UniqueName
=
"workflow"
ReadOnly
=
"True"
>
</
telerik:GridBoundColumn
>
</
Columns
>
</
MasterTableView
>
</
telerik:RadGrid
>
I need the DropDownList datasource to have a parameter from a cell value on the selected row. The DataKeyName also contains the same value that could be used as a parm.
<
asp:SqlDataSource
ID
=
"SqlDataSourceInstruments"
runat
=
"server"
ConnectionString="<%$ ConnectionStrings:MineLIMSConnection %>"
SelectCommand="SELECT distinct i.instrument_id, i.instrument, tst.set_test_id
FROM instruments i
Inner Join tests_instruments ti on ti.instrument_id = i.instrument_id
Inner Join ml_temp_dest_sets_tests tst on tst.test_id = ti.test_id
WHERE tst.set_test_id = @set_test_id">
<
SelectParameters
>
<
asp:ControlParameter
ControlID
=
"RadGridTestsInstruments"
DefaultValue
=
"999"
Name
=
"set_test_id"
PropertyName
=
"SelectedValues['set_test_id']"
Type
=
"Int32"
/>
</
SelectParameters
>
</
asp:SqlDataSource
>
When I try to use a ControlParameter from the Grid itself as shown above, I get this error:
Could not find control 'RadGridTestsInstruments' in ControlParameter 'set_test_id'.
<
asp:SqlDataSource
ID
=
"SqlDataSourceInstruments"
runat
=
"server"
ConnectionString="<%$ ConnectionStrings:MineLIMSConnection %>"
SelectCommand="SELECT distinct i.instrument_id, i.instrument, tst.set_test_id
FROM instruments i
Inner Join tests_instruments ti on ti.instrument_id = i.instrument_id
Inner Join ml_temp_dest_sets_tests tst on tst.test_id = ti.test_id
WHERE tst.set_test_id = @set_test_id">
<
SelectParameters
>
<
asp:Parameter
Name
=
"set_test_id"
Type
=
"Int32"
/>
</
SelectParameters
>
</
asp:SqlDataSource
>
If I just use a Parameter from the Grid itself as shown above, there is nothing returned.
I am thinking that I should be going this route, but I must not be setting the right field on the Grid and/or dropdown to set the parameter properly.
If I remove the parameter completely, I get data, but from all rows in the Grid, which is incorrect.
Thanks in advance,
g.