Hello,
I have a hierarchic grid. Something like that (I tried to keep only the interesting lines).
At first level (MasterTableView), the records have a "data key name" (sourceID)
At second level, the records have also the same data key name (So I have a "grid relation fileds" between the two identifers)
At second level, there is another field (element) with a value provided by a radcombobox.
I want that, in edit mode, the available element values in the radcombobox depend on the sourceID.
See the following object data source:
It works correctly when I am in Edit mode in order to UPDATE a record. The sourceID used seems to be the one of the record.
But, when I enter in edit mode in order to INSERT a new record (via the "Add a record button"), the sourceID parameter, received by the objectdatasource method (GetElementsListBySource) is null. As the record still not exists, no sourceID can't be used.
My question is: How could a get the parent record sourceID to pass it to the objectdatasource method providing my elements ?
I would like, if possible, make that declaratively in the aspx file to keep the same usage of objectdatasource.
Thanks by advance.
Damien
I have a hierarchic grid. Something like that (I tried to keep only the interesting lines).
<
telerik:RadGrid
ID
=
"RadGrid1"
runat
=
"server"
>
<
MasterTableView
AutoGenerateColumns
=
"False"
Name
=
"LEVEL1"
DataKeyNames
=
"SourceID"
CommandItemDisplay
=
"Top"
EditMode
=
"EditForms"
DataSourceID
=
"ObjectDataSource1"
>
<
Columns
>
<
telerik:GridBoundColumn
UniqueName
=
"SourceID"
DataField
=
"SourceID"
ReadOnly
=
"true"
/>
</
Columns
>
<
DetailTables
>
<
telerik:GridTableView
AutoGenerateColumns
=
"False"
Name
=
"LEVEL2"
DataKeyNames
=
"SourceID"
runat
=
"server"
CommandItemDisplay
=
"Top"
DataSourceID
=
"ObjectDataSource4"
>
<
ParentTableRelation
>
<
telerik:GridRelationFields
DetailKeyField
=
"SourceID"
MasterKeyField
=
"SourceID"
/>
</
ParentTableRelation
>
<
Columns
>
<
telerik:GridBoundColumn
UniqueName
=
"SourceID"
DataField
=
"SourceID"
ReadOnly
=
"true"
/>
<
telerik:GridDropDownColumn
UniqueName
=
"ElementShortNameID"
DataField
=
"ElementID"
HeaderText
=
"Element Short Name ID"
ReadOnly
=
"false"
DropDownControlType
=
"RadComboBox"
DataSourceID
=
"ObjectDataSource5"
ListTextField
=
"ElementShortNameID"
ListValueField
=
"ElementID"
/>
</
Columns
>
</
telerik:GridTableView
>
</
DetailTables
>
</
MasterTableView
>
</
telerik:RadGrid
>
At first level (MasterTableView), the records have a "data key name" (sourceID)
At second level, the records have also the same data key name (So I have a "grid relation fileds" between the two identifers)
At second level, there is another field (element) with a value provided by a radcombobox.
I want that, in edit mode, the available element values in the radcombobox depend on the sourceID.
See the following object data source:
<
asp:ObjectDataSource
ID
=
"ObjectDataSource5"
runat
=
"server"
TypeName
=
"DataAccessLayer.DataSource.ElementDataSource"
SelectMethod
=
"GetElementsListBySource"
>
<
SelectParameters
>
<
asp:Parameter
Name
=
"SourceID"
Type
=
"String"
></
asp:Parameter
>
</
SelectParameters
>
</
asp:ObjectDataSource
>
It works correctly when I am in Edit mode in order to UPDATE a record. The sourceID used seems to be the one of the record.
But, when I enter in edit mode in order to INSERT a new record (via the "Add a record button"), the sourceID parameter, received by the objectdatasource method (GetElementsListBySource) is null. As the record still not exists, no sourceID can't be used.
My question is: How could a get the parent record sourceID to pass it to the objectdatasource method providing my elements ?
I would like, if possible, make that declaratively in the aspx file to keep the same usage of objectdatasource.
Thanks by advance.
Damien