By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
432,483 Members | 1,001 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 432,483 IT Pros & Developers. It's quick & easy.

Using Javascript ScrollIntoView method on a web form

P: n/a
I have a web form that contains a repeater control that is designed to ask
like a check book register. Clicking on a certain transaction takes the user
to a different .aspx page where it can be edited and then saved. Currently,
after saving the edited transaction and returning to the check register, the
repeater control table returns to the bottom. I would like the edited
transaction to appear in the table instead. I know that a JavaScript
ScrollIntoView method on the check register .aspx page controls whether the
table scroll defaults to the top or bottom, but I don't know enough about
this method to know what I need to do to use it to scroll to a certain
transaction. Furthermore, I know I'd need to pass some type of parameter
indicating which transaction had been edited, which I imagine would have to
be done through the code-behind page, and I'm not certain how to do this.
Any advice? The code from the check register .aspx page is pasted below.
Thanks!

<%@ Page Language="vb" AutoEventWireup="false"
Codebehind="TransactionLog.aspx.vb" Inherits="IAMVFO_DEV.TransactionLog"
enableviewstate=true%>
<%@ Register TagPrefix="ici" Namespace="ICIValidators"
Assembly="ICIValidators" %>
<%@ OutputCache Location="None" Duration="1" VaryByParam="None" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<title>TransactionLog</title>
<meta content="Microsoft Visual Studio.NET 7.0" name="GENERATOR">
<meta content="Visual Basic 7.0" name="CODE_LANGUAGE">
<meta content="JavaScript" name="vs_defaultClientScript">
<meta content="http://schemas.microsoft.com/intellisense/ie5"
name="vs_targetSchema">
<LINK href="Styles.css" type="text/css" rel="stylesheet">
</HEAD>
<body onresize="return Height();" onload="return Height();"
class="background" bottomMargin="0" leftMargin="0" topMargin="0"
rightMargin="0">
<form id="frmTransaction" runat="server">
<input type="hidden" name="hTrueFalse">
<p><asp:validationsummary id="ValidSum" runat="server" HeaderText="The
following errors were found with your input:" Font-Size="X-Small"
ShowSummary="True"></asp:validationsummary></p>
<TABLE id="Table1" height="30" cellSpacing="0" cellPadding="0"
width="100%" border="0">
<TR>
<TD class="Account_HeaderColor" style="FONT-WEIGHT: bold; FONT-SIZE:
12pt; HEIGHT: 30px">Bank
Register for
<asp:label id="lblAcctNm" Font-Size="Small"
Runat="server"></asp:label></TD>
</TR>
</TABLE>
<table id="tblReconcileHeader" width="100%" border="0" cellSpacing="1">
<COLGROUP>
<COL id="colReconcileHead1" align="middle">
<COL id="colReconcileHead2" align="middle">
<COL id="colReconcileHead3" align="middle">
<COL id="colReconcileHead4" align="middle">
<COL id="colReconcileHead5" align="middle">
<COL id="colReconcileHead6" align="middle">
</COLGROUP>
<tr class="ShadeColHeaderDark">
<td id="tblReconcileHeader2_1" style="FONT-SIZE: 10pt"
class="TableHeaders">Bank
Reconciliation Due By:
<asp:label id="lblRecDueDate" Font-Size="X-Small"
Runat="server"></asp:label>
<asp:linkbutton id="lnkOverdue" onclick="lnkOverdue_Click"
Runat="server" text="Overdue" Enabled="false" Visible="False"
ForeColor="Red">Overdue</asp:linkbutton></td>
<td id="tblReconcileHeader2_2" class="TableHeaders"><asp:button
id="btnFindTrans" Runat="server" Text="Find
Transaction"></asp:button><asp:button id="btnCorrectBal" Runat="server"
Text="Correct Balance"></asp:button></td>
</tr>
</table>
<asp:repeater id="rptTransaction" runat="server">
<HeaderTemplate>
<div id="divTransHeader" style="VISIBILITY: hidden">
<table id="tblTransHeader" cellspacing="0" border="0"
class="HeaderTable">
<colgroup class="ShadeColHeaderDark">
<col id="colHeader1" align="center">
<col id="colHeader2" align="center">
<col id="colHeader3" align="center">
<col id="colHeader4" align="center">
<col id="colHeader5" align="center">
<col id="colHeader6" align="center">
<col id="colHeader7" align="center">
<col id="colHeader8" align="center">
<col id="colHeader9" align="center">
<col width="*">
</colgroup>
<tr class="TableHeaders">
<td id="tblTransHeader1_0">
<asp:LinkButton id="lnkSortDate" OnCommand="SortData"
CommandArgument="date" text="Date" Runat="server"
ForeColor="#000000"></asp:LinkButton></td>
<td id="tblTransHeader1_1">
<asp:LinkButton id="lnkSortNumber" OnCommand="SortData"
CommandArgument="number" text="Number" Runat="server"
ForeColor="#000000"></asp:LinkButton></td>
<td id="tblTransHeader1_2" colspan="2">
<asp:LinkButton id="lnkSortDesc" OnCommand="SortData"
CommandArgument="description" text="Description" Runat="server"
ForeColor="#000000"></asp:LinkButton></td>
<td id="tblTransHeader1_3">
<asp:LinkButton id="lnkSortPayType" OnCommand="SortData"
CommandArgument="pay_type" text="Payment Type" Runat="server"
ForeColor="#000000"></asp:LinkButton></td>
<td id="tblTransHeader1_4">
<asp:LinkButton id="lnkSortReceipt" OnCommand="SortData"
CommandArgument="receipt" text="Deposit" Runat="server"
ForeColor="#000000"></asp:LinkButton></td>
<td id="tblTransHeader1_5">
<asp:LinkButton id="lnkSortStatus" OnCommand="SortData"
CommandArgument="Reconciled" text="R/C" Runat="server"
ForeColor="#000000"></asp:LinkButton></td>
<td id="tblTransHeader1_6">
<asp:LinkButton id="lnkSortDisburse" OnCommand="SortData"
CommandArgument="Disbursement" text="Disbursement" Runat="server"
ForeColor="#000000"></asp:LinkButton></td>
<td id="tblTransHeader1_7">Balance</td>
</tr>
<tr class="TableHeaders">
<td id="tblTransHeader2_0"></td>
<td id="tblTransHeader2_1"></td>
<td id="tblTransHeader2_2" style="BORDER-TOP: white 2px solid">
<asp:LinkButton id="lnkSortCat" OnCommand="SortData"
CommandArgument="category" text="Category" Runat="server"
ForeColor="#000000"></asp:LinkButton></td>
<td id="tblTransHeader2_3" style="BORDER-TOP: white 2px solid">
<asp:LinkButton id="lnkSortSubCat" OnCommand="SortData"
CommandArgument="sub_category" text="Sub-Category" Runat="server"
ForeColor="#000000"></asp:LinkButton></td>
<td id="tblTransHeader2_4"></td>
<td id="tblTransHeader2_5"></td>
<td id="tblTransHeader2_6"></td>
<td id="tblTransHeader2_7"></td>
<td id="tblTransHeader2_8"></td>
</tr>
</table>
</div>
<DIV id="divTransBody" style="VISIBILITY: hidden; OVERFLOW: auto;
WIDTH: 100%; HEIGHT: 130px">
<table border="0" cellspacing="0" id="tblTransBody" border="0"
width="100%">
<colgroup class="ShadeColHeaderDark">
<col width="66" id="tblTransBody1" align="center">
<col width="80" id="tblTransBody2" align="center">
<col width="115" id="tblTransBody3" align="center">
<col width="115" id="tblTransBody4" align="center">
<col width="60" id="tblTransBody5" align="center">
<col width="65" id="tblTransBody6" align="center">
<col width="64" id="tblTransBody7" align="center">
<col width="79" id="tblTransBody8" align="center">
<col width="51" id="tblTransBody9" align="center">
<col width="51" id="tblTransBody10" align="center">
</colgroup>
</HeaderTemplate>
<ItemTemplate>
<tr class="Shade_Trans_light" style="COLOR: black">
<td>
<asp:label ID="Label1" text='' runat="server" />
</td>
<td>
<asp:label text='<%# iif(len(trim(Container.DataItem("number") & ""))
0, Container.DataItem("pay_type") & " #" & Container.DataItem("number"),

"")%>' runat="server" ID="Label2"/></td>
<td colspan="2">
<asp:Label ID="lblTransDesc" text='<%#
Container.DataItem("description")%>' Runat=server ForeColor="#000000">
</asp:Label>
<asp:LinkButton ID="lnkTransDesc" text='<%#
Container.DataItem("description")%>' OnCommand="lnkTransDesc_Click"
CommandArgument='<%# Container.DataItem("id")%>' Runat="server"
ForeColor="#000000">
</asp:LinkButton>
</td>
<td>
<asp:Label ID=lblPayType text='<%# Container.DataItem("pay_type")%>'
Runat=server ForeColor="#000000">
</asp:Label>
<asp:LinkButton ID="lnkPayType" text='<%#
Container.DataItem("pay_type")%>' OnCommand="lnkPayType_Click"
CommandArgument='<%# Container.DataItem("id")%>' Runat="server"
ForeColor="#000000">
</asp:LinkButton>
</td>
<td align="right">
<asp:label text='<%# iif(cstr(Container.DataItem("receipt")) = "0",
"", format(Math.Abs(Container.DataItem("receipt")), "0.00"))%>'
runat="server" ID="Label3"/></td>
<td>
<asp:label text='<%# Container.DataItem("Reconciled")%>'
runat="server" ID="Label4"/></td>
<td align="right">
<asp:label text='<%# iif(cstr(Container.DataItem("Disbursement")) =
"0", "", Format(Container.DataItem("Disbursement") * -1, "0.00"))%>'
runat="server" ID="Label5"/></td>
<td align="right">
<asp:label ID="lblBalance" text='<%#
iif(cstr(Container.DataItem("Balance1")) = ".00", "0.00",
Format(Container.DataItem("Balance1"), "0.00;(0.00)"))%>'
runat="server"/></td>
</tr>
<tr class="Shade_Trans_dark" style="COLOR: black; BACKGROUND-COLOR:
gainsboro">
<td></td>
<td colspan="1">
<asp:label ID="lblPayroll" text="PAYROLL" Runat="server"
ForeColor="#0000ff"></asp:label>
<asp:LinkButton ID="lnkTransHistory" text="" CommandArgument='<%#
Container.DataItem("id")%>' OnCommand="lnkTransHistory_Click" Runat="server"
ForeColor="Black">
</asp:LinkButton>
<asp:Label ID="lblTransHistory" Runat="server"></asp:Label>
</td>
<td>
<asp:label ID="lblCategory" text='<%#
Container.DataItem("category")%>' runat="server" />
<asp:LinkButton ID="lnkViewSplit" text="Split"
OnCommand="lnkViewSplit_Click" CommandArgument='<%#
Container.DataItem("id")%>' Runat="server" ForeColor="#000000">
</asp:LinkButton>
</td>
<td>
<asp:label ID="Label7" text='<%#
Container.DataItem("sub_category")%>' runat="server" /></td>
<td colspan="2" align="left">
<asp:label ID="lblFunctionalCat" text='<%#
Container.DataItem("functional_category")%>' runat="server" /></td>
<td colspan="2" align="left">
<asp:LinkButton ID="lnkReturnToCash" text="Return To Cash"
OnCommand="lnkReturnToCash_Click" CommandArgument='<%#
Container.DataItem("id")%>' Runat="server" ForeColor=#0000ff >
</asp:LinkButton>
<asp:LinkButton ID="lnkEditTrans" text="Edit"
OnCommand="lnkEditTrans_Click" CommandArgument='<%#
Container.DataItem("id")%>' Runat="server" ForeColor=#0000ff >
</asp:LinkButton>
<asp:LinkButton ID="lnkViewDetails" text="View Details"
OnCommand="lnkViewDetails_Click" CommandArgument='<%#
Container.DataItem("id")%>' Runat="server" ForeColor=#0000ff >
</asp:LinkButton>
<asp:LinkButton ID="lnkAdjustTrans" text="Adjust"
OnCommand="lnkAdjustTrans_Click" CommandArgument='<%#
Container.DataItem("id")%>' Runat="server" ForeColor=#0000ff >
</asp:LinkButton>
<asp:LinkButton ID="lnkLodgeVoid" text="Void"
OnCommand="lnkLodgeVoid_Click" CommandArgument='<%#
Container.DataItem("id")%>' Runat="server" ForeColor=#0000ff >
</asp:LinkButton>
<asp:LinkButton ID="lnkLodgeUnVoid" text="Un-Void"
OnCommand="lnkLodgeUnVoid_Click" CommandArgument='<%#
Container.DataItem("id")%>' Runat="server" ForeColor=#0000ff >
</asp:LinkButton>
<asp:LinkButton ID="lnkAuditorVoid" text="Void"
OnCommand="lnkAuditorVoid_Click" CommandArgument='<%#
Container.DataItem("id")%>' Runat="server" ForeColor=#0000ff >
</asp:LinkButton>
<asp:LinkButton ID="lnkAuditorUnVoid" text="Un-Void"
OnCommand="lnkAuditorUnVoid_Click" CommandArgument='<%#
Container.DataItem("id")%>' Runat="server" ForeColor=#0000ff >
</asp:LinkButton>
</td>
<td></td>
</tr>
</ItemTemplate>
<SeparatorTemplate>
<tr>
<td colspan="10" height="2" bgcolor="#000000" style="BORDER-RIGHT:
white 1px solid; BORDER-LEFT: white 1px solid;"></td>
</tr>
</SeparatorTemplate>
<FooterTemplate>
</table> </div>
</FooterTemplate>
</asp:repeater>
<TABLE id="tblFooter" width="100%" border="0" cellSpacing="0"
cellPadding="1">
<TR class="ShadeColHeaderDark">
<TD align="middle" class="TableHeaders" style="HEIGHT: 2px">View:
<asp:dropdownlist id="ddlViewPrevious"
Runat="server"></asp:dropdownlist>
Or Enter Date Range From:
<asp:textbox id="txtFromDate" Runat="server"></asp:textbox> To:
<asp:textbox id="txtToDate" Runat="server"></asp:textbox>
<asp:button id="btnGo" Runat="server" Text="Go"></asp:button></TD>
</TR>
<TR class="ShadeColHeaderDark">
<TD align="right" class="Account_HeaderColor" style="HEIGHT:
20px"><asp:linkbutton id="lnkRecordsPrevious" Runat="server" Visible="False"
ForeColor="White" Font-Bold="True"></asp:linkbutton>
<asp:linkbutton id="lnkRecordsNext" Runat="server" Visible="False"
ForeColor="White" Font-Bold="True"></asp:linkbutton></TD>
</TR>
</TABLE>
<asp:label id="lblToday" Runat="server" Visible="False"
DESIGNTIMEDRAGDROP="250"></asp:label><asp:label id="lblAcctBalance"
Runat="server" Visible="False"></asp:label><asp:label id="lblAcctNum"
Runat="server" Visible="False"></asp:label><asp:label id="lblBankNm"
Runat="server" Visible="False"></asp:label><asp:label id="lblAcctType"
Runat="server" Visible="False"></asp:label><asp:label id="lblAcctStatus"
Runat="server" Visible="False"></asp:label><ici:datevalidator
id="dtv_txtFromDate" runat="server" Display="None" ErrorMessage="From Date"
ControlToValidate="txtFromDate"></ici:datevalidator><ici:datevalidator
id="dtv_txtToDate" runat="server" Display="None" ErrorMessage="To Date"
ControlToValidate="txtToDate"></ici:datevalidator><asp:customvalidator
id="cuv_DateRange" runat="server" Display="None" ErrorMessage="The From date
must be less than the To date"
EnableClientScript="False"></asp:customvalidator></form>
<SCRIPT language="javascript" src="AlignGridHeaders.js"></SCRIPT>
<SCRIPT language="javascript">
<!--
//AlignGridHeaders(tblHeaders,dg);
Resizecolumns(tblTransHeader, tblTransBody, divTransBody, 9);
divTransHeader.style.visibility = "visible";
divTransBody.style.visibility = "visible";

tblTransBody.scrollIntoView(false)
//-->
</SCRIPT>
<SCRIPT language="javascript">
function fnGo(){
return confirm ('The results returned more than 1000 records. Do you
wish to continue?');
}
<% if viewstate("iCount") = "greater" then%>
return confirm ('The results returned more than 1000 records. Do you
wish to continue?');
<% end if %>
</SCRIPT>
<script language="javascript">
<!--
//4/11/05-Wrote this function, and added the onload & onresize events
to the <body> tag,
// to resize the transaction log based on screen resolution.
function Height()
{if ((screen.width==1024) && (screen.height==768))
return divTransBody.style.height = 375;
else if ((screen.width==800) && (screen.height==600))
return divTransBody.style.height = 205;}
//-->
</script>
</body>
</HTML>

May 10 '06 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.