Click to See Complete Forum and Search --> : Set focus on a row in a table
yrf9320
May 1st, 2002, 08:58 PM
My page displays a table.
I have to set the focus on a particular row in the table.
How can I do that in ASP.
For Eg.. The page displays 75 rows.
When the page is displayed I want to set the focus on Row 50...
Thanks in advance...
goddess_spanky
May 3rd, 2002, 02:56 PM
I guess the easiest way to do this would be to have a record counter each time you loop through the recordset and have a checkbox/radiobutton/input box named that number. then trigger an event once the page is done loading to set focus to that element.
Something like this (very basic example):
script language="javascript"
function SelectRow() {
document.form.Row50.focus();
}
...
body onLoadComplete="SelectRow()"
(whatever the event handler for a page finished loading is - I can't remember right now what it is)
...
start asp stuff
....
<%
'assuming you have already connected to the database and created your recordset (named "rs" in this case)
intCounter=0
if not rs.eof
do while not rs.eof
intCounter = intCounter+1
response.Write("<INPUT TYPE=""TEXT"" Name=""Row" & intCounter & chr(34) & " ReadOnly></INPUT>")
...'write rest of row information
rs.movenext
loop
end if
%>
~goddess
goddess_spanky@hotmail.com
codeguru.com
Copyright WebMediaBrands Inc., All Rights Reserved.