i wanted to automatically tick a record row after editing and then move the arrow key down to the next row but the cursor is not moving please help. i wanted the ticked record to appear in the checkbox on the gridview
<%@ Page Title="" Language="vb" AutoEventWireup="false" MasterPageFile="~/FormsV2/Site1.Master" CodeBehind="CursorMove.aspx.vb" Inherits="SMIS2022WEB.CursorMove1" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>
<script type="text/javascript">
$("[id*=GridView1] input, [id*=GridView1] select").on("keydown", function (e) {
var selector = $(this)[0].tagName;
if (typeof ($(this).attr("type")) != "undefined") {
selector += '[type=' + $(this).attr("type") + ']';
}
if (e.keyCode == 40) {
var next = $(this).closest("tr").next().find(selector);
if (next.length > 0) {
next.focus();
}
}
if (e.keyCode == 38) {
var prev = $(this).closest("tr").prev().find(selector);
if (prev.length > 0) {
prev.focus();
}
}
})
</script>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
<asp:GridView ID="GridView1" HeaderStyle-BackColor="#3AC0F2" HeaderStyle-ForeColor="White"
runat="server" AutoGenerateColumns="False">
<Columns>
<asp:BoundField DataField="Id" HeaderText="Id" ItemStyle-Width="30" >
<ItemStyle Width="30px"></ItemStyle>
</asp:BoundField>
<asp:BoundField DataField="Name" HeaderText="Name" ItemStyle-Width="150" >
<ItemStyle Width="150px"></ItemStyle>
</asp:BoundField>
<asp:BoundField DataField="Country" HeaderText="Country" ItemStyle-Width="150" >
<ItemStyle Width="150px"></ItemStyle>
</asp:BoundField>
<asp:TemplateField>
<ItemTemplate>
<asp:TextBox runat="server" />
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Tick">
<ItemTemplate>
<asp:CheckBox Text="text" runat="server" />
</ItemTemplate>
</asp:TemplateField>
</Columns>
<HeaderStyle BackColor="#3AC0F2" ForeColor="White"></HeaderStyle>
</asp:GridView>
</asp:Content>
Imports System.Data
Imports System.Data.SqlClient
Imports System.Configuration
Public Class CursorMove1
Inherits System.Web.UI.Page
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
If Not Me.IsPostBack Then
Dim dt As New DataTable()
dt.Columns.AddRange(New DataColumn(2) {New DataColumn("Id", GetType(Integer)), New DataColumn("Name", GetType(String)), New DataColumn("Country", GetType(String))})
dt.Rows.Add(1, "John Hammond", "United States")
dt.Rows.Add(2, "Mudassar Khan", "India")
dt.Rows.Add(3, "Suzanne Mathews", "France")
dt.Rows.Add(4, "Robert Schidner", "Russia")
GridView1.DataSource = dt
GridView1.DataBind()
End If
End Sub
End Class