I have two grids on my page.
The user is to select a row from grid1 which will display details of that row in grid 2
My datasource for grid 2 is set to take the selected index from grid 1. Here is my code for the grids
Grid 1
Code behind for Grid 1
GetFileList Datasource
Grid 2 (to display details from selected row in Grid 1)
Codebehind for Grid 2
GetFileHistory Datasource
Not sure why these are not linking. Do I need to specify additional postback code?
The user is to select a row from grid1 which will display details of that row in grid 2
My datasource for grid 2 is set to take the selected index from grid 1. Here is my code for the grids
Grid 1
<
telerik:RadGrid
ID
=
"FileList"
Width
=
"97%"
AllowPaging
=
"True"
runat
=
"server"
AllowSorting
=
"True"
OnNeedDataSource
=
"FileList_NeedDataSource"
GridLines
=
"None"
AutoGenerateColumns
=
"False"
Skin
=
"Windows7"
Height
=
"220px"
>
<
HeaderContextMenu
EnableImageSprites
=
"True"
></
HeaderContextMenu
>
<
MasterTableView
Width
=
"100%"
DataKeyNames
=
"FileID"
>
<
CommandItemSettings
ExportToPdfText
=
"Export to Pdf"
></
CommandItemSettings
>
<
Columns
>
<
telerik:GridBoundColumn
DataField
=
"FileID"
DataType
=
"System.Int32"
HeaderText
=
"FileID"
SortExpression
=
"FileID"
UniqueName
=
"FileID"
ReadOnly
=
"True"
Visible
=
"false"
>
</
telerik:GridBoundColumn
>
<
telerik:GridBoundColumn
DataField
=
"FileNumber"
HeaderText
=
"File Number"
SortExpression
=
"FileNumber"
UniqueName
=
"FileNumber"
HeaderStyle-Width
=
"85px"
ItemStyle-HorizontalAlign
=
"Center"
>
<
HeaderStyle
Width
=
"85px"
></
HeaderStyle
>
<
ItemStyle
HorizontalAlign
=
"Center"
></
ItemStyle
>
</
telerik:GridBoundColumn
>
<
telerik:GridBoundColumn
DataField
=
"DateEntered"
DataType
=
"System.DateTime"
DataFormatString
=
"{0:dd/MM/yyyy}"
HeaderText
=
"Date Entered"
SortExpression
=
"DateEntered"
UniqueName
=
"DateEntered"
HeaderStyle-Width
=
"85px"
>
<
HeaderStyle
Width
=
"85px"
></
HeaderStyle
>
</
telerik:GridBoundColumn
>
<
telerik:GridBoundColumn
DataField
=
"DateBoxed"
DataType
=
"System.DateTime"
DataFormatString
=
"{0:dd/MM/yyyy}"
HeaderText
=
"Date Boxed"
SortExpression
=
"DateBoxed"
UniqueName
=
"DateBoxed"
HeaderStyle-Width
=
"85px"
>
<
HeaderStyle
Width
=
"85px"
></
HeaderStyle
>
</
telerik:GridBoundColumn
>
<
telerik:GridBoundColumn
DataField
=
"DestroyDate"
DataType
=
"System.DateTime"
HeaderStyle-Width
=
"100px"
HeaderText
=
"Destroy Date"
ReadOnly
=
"True"
SortExpression
=
"DestroyDate"
DataFormatString
=
"{0:dd/MM/yyyy}"
UniqueName
=
"DestroyDate"
>
<
HeaderStyle
Width
=
"100px"
></
HeaderStyle
>
</
telerik:GridBoundColumn
>
<
telerik:GridBoundColumn
DataField
=
"FileStatus"
HeaderText
=
"File Status"
HeaderStyle-Width
=
"115px"
SortExpression
=
"FileStatus"
UniqueName
=
"FileStatus"
>
<
HeaderStyle
Width
=
"115px"
></
HeaderStyle
>
</
telerik:GridBoundColumn
>
<
telerik:GridBoundColumn
DataField
=
"Business"
DataType
=
"System.Int32"
HeaderText
=
"Business"
SortExpression
=
"Business"
UniqueName
=
"Business"
Visible
=
"false"
>
</
telerik:GridBoundColumn
>
</
Columns
></
MasterTableView
>
<
PagerStyle
Mode
=
"NextPrevAndNumeric"
/>
<
ClientSettings
>
<
Selecting
AllowRowSelect
=
"True"
/>
<
Scrolling
AllowScroll
=
"True"
UseStaticHeaders
=
"True"
/>
</
ClientSettings
>
<
FilterMenu
EnableTheming
=
"True"
>
<
CollapseAnimation
Duration
=
"200"
Type
=
"OutQuint"
/>
</
FilterMenu
>
</
telerik:RadGrid
>
Code behind for Grid 1
Protected Sub FileList_NeedDataSource(ByVal source As Object, ByVal e As GridNeedDataSourceEventArgs) Handles FileList.NeedDataSource
FileList.DataSource = GetFileList
End Sub
GetFileList Datasource
<
asp:SqlDataSource
ID
=
"GetFileList"
runat
=
"server"
ConnectionString="<%$ ConnectionStrings:FileawaySQLConnectionString %>"
SelectCommand="SELECT * FROM [qryFileList] WHERE ([Business] = @Business)">
<
SelectParameters
>
<
asp:ControlParameter
ControlID
=
"lblUserID"
Name
=
"Business"
PropertyName
=
"Text"
Type
=
"Int32"
/>
</
SelectParameters
>
</
asp:SqlDataSource
>
Grid 2 (to display details from selected row in Grid 1)
<
telerik:RadGrid
ID
=
"FileHistory"
Width
=
"97%"
AllowPaging
=
"True"
runat
=
"server"
AllowSorting
=
"True"
OnNeedDataSource
=
"FileHistory_NeedDataSource"
GridLines
=
"None"
AutoGenerateColumns
=
"False"
Skin
=
"Windows7"
Height
=
"220px"
>
<
HeaderContextMenu
EnableImageSprites
=
"True"
></
HeaderContextMenu
>
<
MasterTableView
Width
=
"100%"
>
<
CommandItemSettings
ExportToPdfText
=
"Export to Pdf"
></
CommandItemSettings
>
<
Columns
>
<
telerik:GridBoundColumn
DataField
=
"FileID"
DataType
=
"System.Int32"
HeaderText
=
"FileID"
ReadOnly
=
"True"
SortExpression
=
"FileID"
UniqueName
=
"FileID"
>
</
telerik:GridBoundColumn
>
<
telerik:GridBoundColumn
DataField
=
"FileNumber"
HeaderText
=
"FileNumber"
SortExpression
=
"FileNumber"
UniqueName
=
"FileNumber"
>
</
telerik:GridBoundColumn
>
<
telerik:GridBoundColumn
DataField
=
"FileHistoryAction"
HeaderText
=
"FileHistoryAction"
SortExpression
=
"FileHistoryAction"
UniqueName
=
"FileHistoryAction"
>
</
telerik:GridBoundColumn
>
<
telerik:GridBoundColumn
DataField
=
"DateofAction"
DataType
=
"System.DateTime"
HeaderText
=
"DateofAction"
SortExpression
=
"DateofAction"
UniqueName
=
"DateofAction"
>
</
telerik:GridBoundColumn
>
</
Columns
></
MasterTableView
>
<
PagerStyle
Mode
=
"NextPrevAndNumeric"
/>
<
ClientSettings
>
<
Selecting
AllowRowSelect
=
"True"
/>
<
Scrolling
AllowScroll
=
"True"
UseStaticHeaders
=
"True"
/>
</
ClientSettings
>
<
FilterMenu
EnableTheming
=
"True"
>
<
CollapseAnimation
Duration
=
"200"
Type
=
"OutQuint"
/>
</
FilterMenu
>
</
telerik:RadGrid
>
Codebehind for Grid 2
Protected Sub FileHistory_NeedDataSource(ByVal source As Object, ByVal e As GridNeedDataSourceEventArgs) Handles FileHistory.NeedDataSource
FileList.DataSource = GetFileHistory
End Sub
GetFileHistory Datasource
<
asp:SqlDataSource
ID
=
"GetFileHistory"
runat
=
"server"
ConnectionString="<%$ ConnectionStrings:FileawaySQLConnectionString %>"
SelectCommand="SELECT * FROM [qryFileHistory] WHERE ([FileID] = @FileID)">
<
SelectParameters
>
<
asp:ControlParameter
ControlID
=
"FileList"
Name
=
"FileID"
PropertyName
=
"SelectedValue"
Type
=
"Int32"
/>
</
SelectParameters
>
</
asp:SqlDataSource
>
Not sure why these are not linking. Do I need to specify additional postback code?