I am getting the error below when after entering a figure the cursor jumps and disappears while debugging which internet explorer i got this error.
Line: 6
Error: Sys.WebForms.PageRequestManagerServerErrorException: Object reference not set to an instance of an object.
here is my code
<script type="text/javascript">
function GetSelectedRow(UserLink) {
var row = UserLink.parentNode.parentNode;
var rowIndex = row.rowIndex - 1;
var userId = row.cells[0].innerHTML;
var lable = row.getElementsByTagName("input")[5].value;
if (lable == null || lable == "") {
//if (lable == 100){
// row.getElementsByTagName("input")[8].value = "d";
return true;
}
if (lable >= 0 && lable <= 100) {
return true;
}
else {
alert("Must be between 1 and 100");
return false;
}
}
</script>
<script type="text/javascript">
function enter(obj) {
var tr = obj.parentNode.parentNode;
var cellIndex = obj.parentNode.cellIndex;
var rowIndex = obj.parentNode.parentNode.rowIndex;
if (event.keyCode == 37) //Left
{
if (cellIndex > 0)
tr.parentNode.rows[rowIndex].cells[cellIndex - 1].getElementsByTagName('INPUT')[0].focus();
GetSelectedRow(obj)
return;
}
if (event.keyCode == 38) //Up
{
if (rowIndex > 1)
tr.parentNode.rows[rowIndex - 1].cells[cellIndex].getElementsByTagName('INPUT')[0].focus();
GetSelectedRow(obj)
return;
}
if (event.keyCode == 39) //Right
{
if (cellIndex < tr.cells.length - 1)
tr.parentNode.rows[rowIndex].cells[cellIndex + 1].getElementsByTagName('INPUT')[0].focus();
GetSelectedRow(obj)
return;
}
if (event.keyCode == 40) //Down
{
if (rowIndex < tr.parentNode.rows.length - 1)
tr.parentNode.rows[rowIndex + 1].cells[cellIndex].getElementsByTagName('INPUT')[0].focus();
GetSelectedRow(obj)
return;
}
};
var prm = Sys.WebForms.PageRequestManager.getInstance();
if (prm != null) {
prm.add_endRequest(function (sender, e) {
if (sender._postBackSettings.panelsToUpdate != null) {
var rowIndex = parseInt(document.getElementById("hfRowIndex").value);
var row = document.getElementById("StudentGridMarks").rows[rowIndex + 2];
if (typeof (row) != "undefined") {
var celIndex = parseInt(document.getElementById("hfCellIndex").value);
var controls = row.cells[celIndex].getElementsByTagName("INPUT");
for (var i = 0; i < controls.length; i++) {
switch (controls[i].className) {
case "Remarks":
controls[i].focus();
return;
break;
case "Score":
controls[i].focus();
return;
break;
default:
}
}
}
}
});
}
</script>
<script type="text/javascript">
function enter2(obj) {
var tr = obj.parentNode.parentNode;
var cellIndex = obj.parentNode.cellIndex;
var rowIndex = obj.parentNode.parentNode.rowIndex;
if (event.keyCode == 37) //Left
{
if (cellIndex > 0)
tr.parentNode.rows[rowIndex].cells[cellIndex - 1].getElementsByTagName('INPUT')[0].focus();
GetSelectedRow(obj)
return;
}
if (event.keyCode == 38) //Up
{
if (rowIndex > 1)
tr.parentNode.rows[rowIndex - 1].cells[cellIndex].getElementsByTagName('INPUT')[0].focus();
GetSelectedRow(obj)
return;
}
if (event.keyCode == 39) //Right
{
if (cellIndex < tr.cells.length - 1)
tr.parentNode.rows[rowIndex].cells[cellIndex + 1].getElementsByTagName('INPUT')[0].focus();
GetSelectedRow(obj)
return;
}
if (event.keyCode == 40) //Down
{
if (rowIndex < tr.parentNode.rows.length - 1)
tr.parentNode.rows[rowIndex + 1].cells[cellIndex].getElementsByTagName('INPUT')[0].focus();
GetSelectedRow(obj)
return;
}
};
var prm = Sys.WebForms.PageRequestManager.getInstance();
if (prm != null) {
prm.add_endRequest(function (sender, e) {
if (sender._postBackSettings.panelsToUpdate != null) {
var rowIndex = parseInt(document.getElementById("hfRowIndex").value);
var row = document.getElementById("StudentGridMarks").rows[rowIndex + 2];
if (typeof (row) != "undefined") {
var celIndex = parseInt(document.getElementById("hfCellIndex").value);
var controls = row.cells[celIndex].getElementsByTagName("INPUT");
for (var i = 0; i < controls.length; i++) {
switch (controls[i].className) {
case "A1":
controls[i].focus();
return;
break;
case "A2":
controls[i].focus();
return;
break;
case "A3":
controls[i].focus();
return;
break;
case "A4":
controls[i].focus();
return;
break;
case "A5":
controls[i].focus();
return;
break;
case "A6":
controls[i].focus();
return;
break;
case "A7":
controls[i].focus();
return;
break;
case "A8":
controls[i].focus();
return;
break;
case "A9":
controls[i].focus();
return;
break;
case "A10":
controls[i].focus();
return;
break;
default:
}
}
}
}
});
}
</script>
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>
<asp:GridView ID="StudentGridMarks" runat="server" AllowPaging="True" AutoGenerateColumns="False" OnPageIndexChanging="OnPageIndexChanging" PageSize="45" >
<Columns>
<asp:TemplateField>
<HeaderTemplate>
<asp:CheckBox ID="chkAll" runat="server" AutoPostBack="true" />
</HeaderTemplate>
<ItemTemplate>
<asp:CheckBox ID="CheckBox1" runat="server" AutoPostBack="true" Enabled="False" />
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Admno">
<EditItemTemplate>
<asp:TextBox ID="TextBox3" runat="server" Text='<%# Eval("admno") %>'></asp:TextBox>
</EditItemTemplate>
<ItemTemplate>
<asp:Label ID="Label3" runat="server" Text='<%# Bind("admno") %>' Visible="False"></asp:Label>
<asp:TextBox ID="admno" runat="server" Text='<%# Eval("admno") %>' Height="16px" Width="93px" ReadOnly="True"></asp:TextBox>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Name">
<EditItemTemplate>
<asp:TextBox ID="TextBox1" runat="server" Text='<%# Eval("Name") %>'></asp:TextBox>
</EditItemTemplate>
<ItemTemplate>
<asp:TextBox ID="Name" runat="server" Text='<%# Eval("Name") %>' Height="16px" Width="186px" ReadOnly="True"></asp:TextBox>
<asp:Label ID="Label1" runat="server" Text='<%# Bind("Name") %>' Visible="False"></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Class">
<EditItemTemplate>
<asp:TextBox ID="TextBox2" runat="server" Text='<%# Eval("Class") %>' Height="16px" Width="58px"></asp:TextBox>
</EditItemTemplate>
<ItemTemplate>
<asp:Label ID="Label2" runat="server" Text='<%# Bind("Class") %>' Visible="False"></asp:Label>
<asp:TextBox ID="Class" runat="server" Text='<%# Eval("Class") %>' Height="16px" Width="32px" ReadOnly="True"></asp:TextBox>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Stream">
<EditItemTemplate>
<asp:TextBox ID="TextBox4" runat="server" Height="16px" Text='<%# Bind("Stream") %>' Width="42px"></asp:TextBox>
</EditItemTemplate>
<ItemTemplate>
<asp:Label ID="Label4" runat="server" Text='<%# Bind("Stream") %>' Visible="False"></asp:Label>
<asp:TextBox ID="Stream" runat="server" Height="16px" Text='<%# Eval("Stream") %>' Width="41px" ReadOnly="True"></asp:TextBox>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Score">
<EditItemTemplate>
<asp:TextBox ID="TextBox5" runat="server" Text='<%# Bind("Score") %>'></asp:TextBox>
</EditItemTemplate>
<ItemTemplate>
<asp:Label ID="Label5" runat="server" Text='<%# Bind("Score") %>' Visible="False"></asp:Label>
<asp:TextBox ID="Score" runat="server" Text='<%#Eval("score") %>' CssClass="Score" onkeyup="enter(this)" AutoPostBack="true" OnTextChanged="Score_TextChanged" Height="16px" Width="31px"></asp:TextBox>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Agg">
<EditItemTemplate>
<asp:TextBox ID="TextBox6" runat="server" Text='<%# Bind("Grade") %>'></asp:TextBox>
</EditItemTemplate>
<ItemTemplate>
<asp:Label ID="Label6" runat="server" Text='<%# Bind("Grade") %>' Visible="False"></asp:Label>
<asp:TextBox ID="Agg" runat="server" Height="16px" ReadOnly="True" Text='<%# Eval("Grade") %>' Width="29px"></asp:TextBox>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Remarks">
<EditItemTemplate>
<asp:TextBox ID="TextBox7" runat="server" Text='<%# Bind("Remark") %>'></asp:TextBox>
</EditItemTemplate>
<ItemTemplate>
<asp:Label ID="Label7" runat="server" Text='<%# Bind("Remark") %>' Visible="False"></asp:Label>
<asp:TextBox ID="Remarks" runat="server" Text='<%# Eval("Remark") %>' CssClass="Remarks"
AutoPostBack="True" OnTextChanged="Remarks_TextChanged" Height="18px" onkeyup="enter(this)" Width="431px"></asp:TextBox>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="UserName">
<EditItemTemplate>
<asp:TextBox ID="TextBox8" runat="server"></asp:TextBox>
</EditItemTemplate>
<ItemTemplate>
<asp:Label ID="Label8" runat="server" Visible="False"></asp:Label>
<asp:TextBox ID="UserName" runat="server" Text='<%# Eval("Username") %>' Height="16px" Width="106px" ReadOnly="True"></asp:TextBox>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="DateTime">
<EditItemTemplate>
<asp:TextBox ID="TextBox9" runat="server"></asp:TextBox>
</EditItemTemplate>
<ItemTemplate>
<asp:Label ID="Label9" runat="server" Visible="False"></asp:Label>
<asp:TextBox ID="DateTime" runat="server" Height="16px" Text='<%# Eval("time") %>' Width="151px" ReadOnly="True"></asp:TextBox>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="A1">
<ItemTemplate>
<asp:TextBox ID="A1" runat="server" Height="16px" Text='<%# Eval("A1") %>' onkeyup="enter2(this)" Width="29px" OnTextChanged="A1_TextChanged" AutoPostBack="True"></asp:TextBox>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="A2">
<ItemTemplate>
<asp:TextBox ID="A2" runat="server" Height="16px" Text='<%# Eval("A2") %>' onkeyup="enter2(this)" Width="29px" OnTextChanged="A2_TextChanged" AutoPostBack="True"></asp:TextBox>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="A3">
<ItemTemplate>
<asp:TextBox ID="A3" runat="server" Height="16px" Text='<%# Eval("A3") %>' onkeyup="enter2(this)" Width="29px" OnTextChanged="A3_TextChanged" AutoPostBack="True"></asp:TextBox>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="A4">
<ItemTemplate>
<asp:TextBox ID="A4" runat="server" Height="16px" Text='<%# Eval("A4") %>' onkeyup="enter2(this)" Width="29px" OnTextChanged="A4_TextChanged" AutoPostBack="True"></asp:TextBox>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="A5">
<ItemTemplate>
<asp:TextBox ID="A5" runat="server" Height="16px" Text='<%# Eval("A5") %>' onkeyup="enter2(this)" Width="29px" OnTextChanged="A5_TextChanged" AutoPostBack="True"></asp:TextBox>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="A6">
<ItemTemplate>
<asp:TextBox ID="A6" runat="server" Height="16px" Text='<%# Eval("A6") %>' onkeyup="enter2(this)" Width="29px" OnTextChanged="A6_TextChanged" AutoPostBack="True"></asp:TextBox>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="A7">
<ItemTemplate>
<asp:TextBox ID="A7" runat="server" Height="16px" Text='<%# Eval("A7") %>' Width="29px" OnTextChanged="A7_TextChanged" AutoPostBack="True"></asp:TextBox>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="A8">
<ItemTemplate>
<asp:TextBox ID="A8" runat="server" Height="16px" Text='<%# Eval("A8") %>' Width="29px" OnTextChanged="A8_TextChanged" AutoPostBack="True"></asp:TextBox>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="A9">
<ItemTemplate>
<asp:TextBox ID="A9" runat="server" Height="16px" Text='<%# Eval("A9") %>' Width="29px" OnTextChanged="A9_TextChanged" AutoPostBack="True"></asp:TextBox>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="A10">
<ItemTemplate>
<asp:TextBox ID="A10" runat="server" Height="16px" Text='<%# Eval("A10") %>' Width="29px" OnTextChanged="A10_TextChanged" AutoPostBack="True"></asp:TextBox>
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
<asp:HiddenField ID="hfRowIndex" runat="server" />
<asp:HiddenField ID="hfCellIndex" runat="server" />
<asp:Label ID="lblTotal" runat="server" />
</ContentTemplate>
</asp:UpdatePanel>
Protected Sub A1_TextChanged(sender As Object, e As EventArgs)
Dim row As GridViewRow = TryCast((TryCast(sender, TextBox)).NamingContainer, GridViewRow)
Dim kk As String = row.RowIndex
DirectCast(StudentGridMarks.Rows(kk).Cells(1).FindControl("checkbox1"), CheckBox).Checked = True
hfRowIndex.Value = row.RowIndex.ToString()
hfCellIndex.Value = "1"
Exit Sub
End Sub
Protected Sub A2_TextChanged(sender As Object, e As EventArgs)
Dim row As GridViewRow = TryCast((TryCast(sender, TextBox)).NamingContainer, GridViewRow)
Dim kk As String = row.RowIndex
DirectCast(StudentGridMarks.Rows(kk).Cells(1).FindControl("checkbox1"), CheckBox).Checked = True
hfRowIndex.Value = row.RowIndex.ToString()
hfCellIndex.Value = "2"
Exit Sub
End Sub
Protected Sub A3_TextChanged(sender As Object, e As EventArgs)
Dim row As GridViewRow = TryCast((TryCast(sender, TextBox)).NamingContainer, GridViewRow)
Dim kk As String = row.RowIndex
DirectCast(StudentGridMarks.Rows(kk).Cells(1).FindControl("checkbox1"), CheckBox).Checked = True
hfRowIndex.Value = row.RowIndex.ToString()
hfCellIndex.Value = "3"
End Sub
Protected Sub A4_TextChanged(sender As Object, e As EventArgs)
Dim row As GridViewRow = TryCast((TryCast(sender, TextBox)).NamingContainer, GridViewRow)
Dim kk As String = row.RowIndex
DirectCast(StudentGridMarks.Rows(kk).Cells(1).FindControl("checkbox1"), CheckBox).Checked = True
hfRowIndex.Value = row.RowIndex.ToString()
hfCellIndex.Value = "4"
End Sub
Protected Sub A5_TextChanged(sender As Object, e As EventArgs)
Dim row As GridViewRow = TryCast((TryCast(sender, TextBox)).NamingContainer, GridViewRow)
Dim kk As String = row.RowIndex
DirectCast(StudentGridMarks.Rows(kk).Cells(1).FindControl("checkbox1"), CheckBox).Checked = True
hfRowIndex.Value = row.RowIndex.ToString()
hfCellIndex.Value = "5"
End Sub
Protected Sub A6_TextChanged(sender As Object, e As EventArgs)
Dim row As GridViewRow = TryCast((TryCast(sender, TextBox)).NamingContainer, GridViewRow)
Dim kk As String = row.RowIndex
DirectCast(StudentGridMarks.Rows(kk).Cells(1).FindControl("checkbox1"), CheckBox).Checked = True
hfRowIndex.Value = row.RowIndex.ToString()
hfCellIndex.Value = "6"
End Sub
Protected Sub A7_TextChanged(sender As Object, e As EventArgs)
Dim row As GridViewRow = TryCast((TryCast(sender, TextBox)).NamingContainer, GridViewRow)
Dim kk As String = row.RowIndex
DirectCast(StudentGridMarks.Rows(kk).Cells(1).FindControl("checkbox1"), CheckBox).Checked = True
hfRowIndex.Value = row.RowIndex.ToString()
hfCellIndex.Value = "7"
End Sub
Protected Sub A8_TextChanged(sender As Object, e As EventArgs)
Dim row As GridViewRow = TryCast((TryCast(sender, TextBox)).NamingContainer, GridViewRow)
Dim kk As String = row.RowIndex
DirectCast(StudentGridMarks.Rows(kk).Cells(1).FindControl("checkbox1"), CheckBox).Checked = True
hfRowIndex.Value = row.RowIndex.ToString()
hfCellIndex.Value = "8"
End Sub
Protected Sub A9_TextChanged(sender As Object, e As EventArgs)
Dim row As GridViewRow = TryCast((TryCast(sender, TextBox)).NamingContainer, GridViewRow)
Dim kk As String = row.RowIndex
DirectCast(StudentGridMarks.Rows(kk).Cells(1).FindControl("checkbox1"), CheckBox).Checked = True
hfRowIndex.Value = row.RowIndex.ToString()
hfCellIndex.Value = "9"
End Sub
Protected Sub A10_TextChanged(sender As Object, e As EventArgs)
Dim row As GridViewRow = TryCast((TryCast(sender, TextBox)).NamingContainer, GridViewRow)
Dim kk As String = row.RowIndex
DirectCast(StudentGridMarks.Rows(kk).Cells(1).FindControl("checkbox1"), CheckBox).Checked = True
hfRowIndex.Value = row.RowIndex.ToString()
hfCellIndex.Value = "10"
End Sub