<
telerik:RadGrid ID="RadGrid1" runat="server" Width="150"
PageSize="20" AllowSorting="True" AllowMultiRowSelection="False" Skin="Default"
AllowPaging="True" ShowGroupPanel="True" AutoGenerateColumns="false" GridLines="none" OnItemCommand="RadGrid1_ItemCommand">
</telerik:RadGrid>
then in the default.aspx.vb i have a pageload to load the data and column.
RadGrid1.DataSource = "sqlsource1"
Dim boundcolumn As GridBoundColumn
boundcolumn =
New GridBoundColumn
boundcolumn.DataField =
"Department"
boundcolumn.HeaderText =
"Department"
RadGrid1.MasterTableView.Columns.Add(boundcolumn)
RadGrid1.DataBind()
now i want to be able to detect a click on the row click and then open something with the column value like the Auto postback on row click example that you guys have on the web. i could detect the click but it keeps giving me error of "Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: index"
here is my onclick itemcommand code
Protected
Sub RadGrid1_ItemCommand(ByVal source As Object, ByVal e As Telerik.Web.UI.GridCommandEventArgs) Handles RadGrid1.ItemCommand
Thread.Sleep(2000)
If (e.CommandName = "RowClick" AndAlso TypeOf e.Item Is GridDataItem) Then
e.Item.Selected =
True
Dim text As String = "Selected mail ID is: " & e.Item.OwnerTableView.DataKeyValues(e.Item.ItemIndex)("MailID")
RadGrid1.Controls.Add(
New LiteralControl(String.Format("<span style='color:red'>{0}</span>", text)))
End If
End Sub
what did i do wrong here? could you help me. thank you very much