There is a solution which might help you
On every 5 table add the below property
onclick="MakeSelected(this)">
Below is the implementation of the
<script language="javascript" type="text/javascript">
function MakeSelected(ctrl) {
document.getElementById('<%= hdnVal.ClientID%>').value = ctrl.id;
}
</script
I created a hidden control on the page with the name "hdnVal" so that we can preserve the ID of the selected table.
Now before end of the <form> tag just add below code
<script language="javascript" type="text/javascript">
if (document.getElementById('<%= hdnVal.ClientID%>') != null && document.getElementById('<%= hdnVal.ClientID%>').value != "")
document.getElementById(document.getElementById('<%= hdnVal.ClientID%>').value).focus();
</script>
SO your code would look like that
<head runat="server">
<script language="javascript" type="text/javascript">
function MakeSelected(ctrl) {
document.getElementById('<%= hdnVal.ClientID%>').value = ctrl.id;
}
</script>
</head>
<body>
<form id="form1" runat="server">
<div>
<input type="hidden" runat="server" id="hdnVal" />
<table width="600" cellpadding="0" cellspacing="0" id="table1" onclick="MakeSelected(this)">
<tr>
<td>
</td>
</tr>
</table>
</div>
<script language="javascript" type="text/javascript">
if (document.getElementById('<%= hdnVal.ClientID%>') != null && document.getElementById('<%= hdnVal.ClientID%>').value != "")
document.getElementById(document.getElementById('<%= hdnVal.ClientID%>').value).focus();
</script>
</form>
</body>