<
telerik:GridButtonColumn
UniqueName
=
"SendColumn"
ButtonType
=
"LinkButton"
CommandName
=
"Select2"
Text
=
"Versturen"
ConfirmText
=
"Verstuur order, weet u het zeker ?"
>
<
HeaderStyle
Width
=
"60px"
/>
<
ItemStyle
Width
=
"60px"
HorizontalAlign
=
"Center"
/>
</
telerik:GridButtonColumn
>
<
telerik:GridButtonColumn
UniqueName
=
"CancelColumn"
ButtonType
=
"LinkButton"
CommandName
=
"Delete"
Text
=
"Annuleren"
ConfirmText
=
"Annuleer order, weet u het zeker ?"
>
<
HeaderStyle
Width
=
"60px"
/>
<
ItemStyle
Width
=
"60px"
HorizontalAlign
=
"Center"
/>
</
telerik:GridButtonColumn
>
<
telerik:GridButtonColumn
UniqueName
=
"ViewColumn"
ButtonType
=
"LinkButton"
CommandName
=
"Select1"
Text
=
"Inzien"
>
<
HeaderStyle
Width
=
"50px"
/>
<
ItemStyle
Width
=
"50px"
HorizontalAlign
=
"Center"
/>
</
telerik:GridButtonColumn
>
>>>>
<
ClientEvents
OnCommand
=
"RadGridCommand"
/>
<<<<
<
script
type
=
"text/javascript"
>
function RadGridCommand(sender, args) {
if (args.get_commandName() == "Select1") {
var itemIndex = args.get_commandArgument();
var rowID=sender.get_masterTableView().get_dataItems()[itemIndex].getDataKeyValue("opls_id");
window.open("BestellingAcademieWBView.aspx?ID=" + rowID ,"contentpage");
args.set_cancel(true);
}
}
</
script
>
I use Clientside event to open een nieuw page as you can see.
Serverside I have the follow code:
Private Sub RadGrid1_ItemCommand(ByVal source As Object, ByVal e As Telerik.Web.UI.GridCommandEventArgs) Handles RadGrid1.ItemCommand
Try
Select Case e.CommandName
Case Is = "Select"
Dim editedItem As GridEditableItem = TryCast(e.Item, GridEditableItem)
Dim intOrderID As Int32 = editedItem.GetDataKeyValue("opls_id")
'Send1(item)
'e.Item.OwnerTableView.Rebind()
Case Is = "Select2"
Dim editedItem As GridEditableItem = TryCast(e.Item, GridEditableItem)
Dim intOrderID As Int32 = editedItem.GetDataKeyValue("opls_id")
'Send1(item)
'e.Item.OwnerTableView.Rebind()
Case Is = "Delete"
Dim editedItem As GridEditableItem = TryCast(e.Item, GridEditableItem)
Dim intOrderID As Int32 = editedItem.GetDataKeyValue("opls_id")
'SendOrderCancel(intOrderID)
'e.Item.OwnerTableView.Rebind()
End Select
Catch ex As Exception
Me.AddErrorMessage(ex.Message)
End Try
End Sub
Facts:
- if i click column: CancelColumn (with commandname="Delete") is gives me the right intOrderID.
- if i click column: SendColumn (with commandname="Select2") is gives me the intOrderID of the FIRST row in the grid, even if i select e.g. the THIRD row.
- if i rename the CommandName="Select2" to "Select" and also handle serverside "Select" and i click column: SendColumn is gives me the right intOrderID (thus the row I selected).
- if I remove the <ClientEvents OnCommand="RadGridCommand" /> and i click column: SendColumn (with commandname="Select2") it gives me the right intOrderID (thus the row I selected).
Question:
I want to use the Cancelcolumn with CommandName="SELECT2" and also use the ClientEvent OnCommand.
Can anyone help me figure this out?!?!??!?