Heyas;
I thought I had a fairly straight forward thing going on, but it seems I'm stumbling over syntax. I am hoping someone can quickly clue me in so I can get this page knocked out. Basically, I have a grid with a heirarchy. In the detail view, there's a button that fires the "Select" command. When that happens, I need to get 2-3 data values from the selected record in the detail, and pass them to a variable for the next step. I know the code needs to go in the ItemCommand event, but I'm not sure on the syntax. Most of what I'm trying hasn't really met with much success, and I think it is because I am a little confused how the "bubble up" works when it comes to implementation.
Here's the relevant ASPX code:
And following area my feeble attempts on the vb.net side (I know the code is incomplete)
Obviously, this doesn't work so well. Can someone give me a pointer in the right direction?
I thought I had a fairly straight forward thing going on, but it seems I'm stumbling over syntax. I am hoping someone can quickly clue me in so I can get this page knocked out. Basically, I have a grid with a heirarchy. In the detail view, there's a button that fires the "Select" command. When that happens, I need to get 2-3 data values from the selected record in the detail, and pass them to a variable for the next step. I know the code needs to go in the ItemCommand event, but I'm not sure on the syntax. Most of what I'm trying hasn't really met with much success, and I think it is because I am a little confused how the "bubble up" works when it comes to implementation.
Here's the relevant ASPX code:
<
telerik:RadGrid
ID
=
"CreditsGrid"
runat
=
"server"
AllowPaging
=
"True"
AllowSorting
=
"True"
DataSourceID
=
"SqlDataSource1"
GridLines
=
"None"
AutoGenerateColumns
=
"False"
>
<
MasterTableView
DataSourceID
=
"SqlDataSource1"
DataKeyNames
=
"OrderID"
>
<
DetailTables
>
<
telerik:GridTableView
runat
=
"server"
DataSourceID
=
"SqlDataSource2"
DataKeyNames
=
"OrderID"
>
<
ParentTableRelation
>
<
telerik:GridRelationFields
MasterKeyField
=
"OrderID"
DetailKeyField
=
"OrderID"
/>
</
ParentTableRelation
>
<
CommandItemSettings
ExportToPdfText
=
"Export to Pdf"
/>
<
Columns
>
<
telerik:GridBoundColumn
DataField
=
"DateCreated"
HeaderText
=
"Date Created"
SortExpression
=
"DateCreated"
UniqueName
=
"DateCreated"
ReadOnly
=
"True"
/>
<
telerik:GridBoundColumn
DataField
=
"EnteredBy"
HeaderText
=
"Entered By"
SortExpression
=
"EnteredBy"
UniqueName
=
"EnteredBy"
ReadOnly
=
"True"
/>
<
telerik:GridBoundColumn
DataField
=
"ChargeCode"
HeaderText
=
"Reason Code"
SortExpression
=
"ChargeCode"
UniqueName
=
"ChargeCode"
ReadOnly
=
"True"
/>
<
telerik:GridBoundColumn
DataField
=
"Description"
HeaderText
=
"Description"
SortExpression
=
"Description"
UniqueName
=
"Description"
ReadOnly
=
"True"
/>
<
telerik:GridButtonColumn
Text
=
"Review Transaction"
ButtonType
=
"LinkButton"
CommandName
=
"Select"
UniqueName
=
"btnRevTrans"
/>
</
Columns
>
</
telerik:GridTableView
>
</
DetailTables
>
<
RowIndicatorColumn
>
<
HeaderStyle
Width
=
"20px"
/>
</
RowIndicatorColumn
>
<
CommandItemSettings
ExportToPdfText
=
"Export to Pdf"
/>
<
ExpandCollapseColumn
>
<
HeaderStyle
Width
=
"20px"
/>
</
ExpandCollapseColumn
>
<
Columns
>
<
telerik:GridBoundColumn
DataField
=
"DateCreated"
DataType
=
"System.DateTime"
HeaderText
=
"Date Created"
SortExpression
=
"DateCreated"
UniqueName
=
"DateCreated"
>
<
HeaderStyle
Width
=
"175px"
/>
<
ItemStyle
Width
=
"175px"
/>
</
telerik:GridBoundColumn
>
<
telerik:GridBoundColumn
DataField
=
"OrderID"
DataType
=
"System.Int32"
HeaderText
=
"OrderID"
SortExpression
=
"OrderID"
UniqueName
=
"OrderID"
>
<
HeaderStyle
Width
=
"200px"
/>
<
ItemStyle
Width
=
"200px"
/>
</
telerik:GridBoundColumn
>
<
telerik:GridBoundColumn
DataField
=
"NumOfOrders"
DataType
=
"System.Int32"
HeaderText
=
"# of Orders"
ReadOnly
=
"True"
SortExpression
=
"NumOfOrders"
UniqueName
=
"NumOfOrders"
>
</
telerik:GridBoundColumn
>
<
telerik:GridButtonColumn
CommandName
=
"Select"
DataTextField
=
"OrderID"
Text
=
"View"
UniqueName
=
"column"
>
</
telerik:GridButtonColumn
>
</
Columns
>
</
MasterTableView
>
</
telerik:RadGrid
>
And following area my feeble attempts on the vb.net side (I know the code is incomplete)
Private
Sub
CreditsGrid_ItemCommand(
ByVal
sender
As
Object
,
ByVal
e
As
Telerik.Web.UI.GridCommandEventArgs)
Handles
CreditsGrid.ItemCommand
If
e.CommandName =
"Select"
Then
'Put selected values to variables
Dim
OrderID = CreditsGrid.MasterTableView.GetSelectedItems(
"OrderID"
)
Dim
CreatedDate = CreditsGrid.MasterTableView.GetSelectedItems(
"CreatedDate"
)
'Removes session variables (just to be safe) & replaces with the new variables.
Session.Remove(
"OrderID"
)
Session.Remove(
"CreatedDate"
)
Session.Add(
"OrderID"
, OrderID)
Session.Add(
"CreatedDate"
, CreatedDate)
'Load Review form.
CreditsWindow.VisibleOnPageLoad =
True
End
If
End
Sub
Obviously, this doesn't work so well. Can someone give me a pointer in the right direction?