469,926 Members | 2,248 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,926 developers. It's quick & easy.

more than 1 per row?

Hey gang.
I know this is probably an easy solution, but I don't remember how to do it.

I have this code;

<%
If rstActiveUsers.RecordCount 0 Then
rstActiveUsers.MoveFirst
Do While Not rstActiveUsers.EOF
var_user1 = session("username") %>
<td class="tdblock" align="left">
<font color="#FFFFFF" style="font-size:
9pt"><%=var_user1%></font></td>
</tr>
<% rstActiveUsers.MoveNext
Loop
End If
%>

it shows names like this;

name1
name2
name3

what i would like it to do, is show like this, with 3 across

name1 name2 name3

i think i remember using a mod or something to pull this off.

can someone help??

TIA
Jeff
Mar 19 '07 #1
10 1317

"Jeff" <ba*@gig-gamers.comwrote in message
news:45***********************@roadrunner.com...
Hey gang.
I know this is probably an easy solution, but I don't remember how to do
it.

I have this code;

<%
If rstActiveUsers.RecordCount 0 Then
rstActiveUsers.MoveFirst
Do While Not rstActiveUsers.EOF
var_user1 = session("username") %>
<td class="tdblock" align="left">
<font color="#FFFFFF" style="font-size:
9pt"><%=var_user1%></font></td>
</tr>
<% rstActiveUsers.MoveNext
Loop
End If
%>

it shows names like this;

name1
name2
name3

what i would like it to do, is show like this, with 3 across

name1 name2 name3

i think i remember using a mod or something to pull this off.

can someone help??

TIA
Jeff
ok, along with this, i thought i had this working in the global.asa, but it
isn't.

i have this in the asa file:..

<object runat="Server" scope="Application"
id="rstActiveUsers" progid="ADODB.Recordset">
</object>

<script language="VBScript" runat="Server">

Sub Application_OnStart()

Const adInteger = 3
Const adVarChar = 200
Const adDate = 7

rstActiveUsers.Fields.Append "id", adInteger
rstActiveUsers.Fields.Append "ip", adVarChar, 15
rstActiveUsers.Fields.Append "browser", adVarChar, 255
rstActiveUsers.Fields.Append "started", adDate

rstActiveUsers.Open
End Sub

Sub Session_OnStart()

Session.Timeout = 20

Session("Start") = Now()

If Not rstActiveUsers.EOF Then rstActiveUsers.MoveLast

rstActiveUsers.AddNew

rstActiveUsers.Fields("id").Value = _
Session.SessionID

rstActiveUsers.Fields("ip").Value = _
Request.ServerVariables("REMOTE_HOST")

rstActiveUsers.Fields("browser").Value = _
Request.ServerVariables("HTTP_USER_AGENT")

rstActiveUsers.Fields("started").Value = _
Now()

rstActiveUsers.Update

End Sub

Sub Session_OnEnd()

Const adSearchForward = 1
Const adBookmarkFirst = 1
Const adAffectCurrent = 1

rstActiveUsers.Find "id = " & Session.SessionID, _
0, adSearchForward, adBookmarkFirst

If Not rstActiveUsers.EOF Then
rstActiveUsers.Delete adAffectCurrent
End If
End Sub

Sub Application_OnEnd()
rstActiveUsers.Close
End Sub
</script>
now what i don't have, and am unable to figure out, is how to get the actual
session usernames.

i have the cookie values as session("username") but i am unsure of where to
put that. i have searched the usual tutorial places, but i don't see where
to get that info.

if anyone can help, i would appreciate it.
at least point me to where i can find this.
Mar 19 '07 #2
Jeff wrote:
<object runat="Server" scope="Application"
id="rstActiveUsers" progid="ADODB.Recordset">
</object>
Bad ... no ... HORRIBLE idea. Do NOT store ADO objects in application or
session unless you have modified the server's registry to mark them
"free-threaded" (which will mean they cannot be used for Jet)
http://www.aspfaq.com/2053

Use an array or free-threaded XML document instead.
--
Microsoft MVP - ASP/ASP.NET
Please reply to the newsgroup. This email account is my spam trap so I
don't check it very often. If you must reply off-line, then remove the
"NO SPAM"
Mar 19 '07 #3
Jeff wrote:
<%
If rstActiveUsers.RecordCount 0 Then
I hope this recordset is disconnected and the connection closed ...
it shows names like this;

name1
name2
name3

what i would like it to do, is show like this, with 3 across

name1 name2 name3

i think i remember using a mod or something to pull this off.
Look, all you are doing in ASP code is generating a string of html
characters. With that in mind, start by creating the hetml that would
display the data as you desire. Then modify the vbscript code to generate
that html.

In this case, instead of writing cell and row end and start tags after each
record, you would write them after a set number of records. Yes, you could
use mod to do this:
if recordsprocessed % 3 =0 then
'write the end and beginning tags
end if
'write the data

Bob Barrows
--
Microsoft MVP - ASP/ASP.NET
Please reply to the newsgroup. This email account is my spam trap so I
don't check it very often. If you must reply off-line, then remove the
"NO SPAM"
Mar 19 '07 #4
Bad ... no ... HORRIBLE idea. Do NOT store ADO objects in application or
session unless you have modified the server's registry to mark them
"free-threaded" (which will mean they cannot be used for Jet)
http://www.aspfaq.com/2053

Use an array or free-threaded XML document instead.
ok, say I am going to totally redo the asa file. Which I am currently
reading on it with the links you provided,
I still can't figure how to use the session("username") for anything in the
asa file. Unless I am missing something, I just don't get it.
Mar 19 '07 #5
Jeff wrote:
>Bad ... no ... HORRIBLE idea. Do NOT store ADO objects in
application or session unless you have modified the server's
registry to mark them "free-threaded" (which will mean they cannot
be used for Jet) http://www.aspfaq.com/2053

Use an array or free-threaded XML document instead.

ok, say I am going to totally redo the asa file. Which I am currently
reading on it with the links you provided,
I still can't figure how to use the session("username") for anything
in the asa file. Unless I am missing something, I just don't get it.
I didn't say anything about that because frankly I don't understand the
problem. A session variable contains nothing until you put something
into it. So you have to get the user name from a user and put it into
the session variable.

--
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don't check it very often. You will get a
quicker response by posting to the newsgroup.
Mar 19 '07 #6

"Bob Barrows [MVP]" <re******@NOyahoo.SPAMcomwrote in message
news:e6**************@TK2MSFTNGP05.phx.gbl...
Jeff wrote:
>>Bad ... no ... HORRIBLE idea. Do NOT store ADO objects in
application or session unless you have modified the server's
registry to mark them "free-threaded" (which will mean they cannot
be used for Jet) http://www.aspfaq.com/2053

Use an array or free-threaded XML document instead.

ok, say I am going to totally redo the asa file. Which I am currently
reading on it with the links you provided,
I still can't figure how to use the session("username") for anything
in the asa file. Unless I am missing something, I just don't get it.

I didn't say anything about that because frankly I don't understand the
problem. A session variable contains nothing until you put something
into it. So you have to get the user name from a user and put it into
the session variable.

--
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don't check it very often. You will get a
quicker response by posting to the newsgroup.

correct. i do have the session variable ("username") as the login name of
the user. this gets assigned on the login page. the problem i am having, is
what to use on the asa page as the session("username") so i can work with it
there.

i guess i am not explaining myself to well.

Session.SessionID

that is the actual session id of the user.
Session.UserName
i know this isn't the session("username")
Mar 19 '07 #7
Jeff wrote:
"Bob Barrows [MVP]" <re******@NOyahoo.SPAMcomwrote in message
news:e6**************@TK2MSFTNGP05.phx.gbl...
>Jeff wrote:
>>>Bad ... no ... HORRIBLE idea. Do NOT store ADO objects in
application or session unless you have modified the server's
registry to mark them "free-threaded" (which will mean they cannot
be used for Jet) http://www.aspfaq.com/2053

Use an array or free-threaded XML document instead.

ok, say I am going to totally redo the asa file. Which I am
currently reading on it with the links you provided,
I still can't figure how to use the session("username") for anything
in the asa file. Unless I am missing something, I just don't get it.

I didn't say anything about that because frankly I don't understand
the problem. A session variable contains nothing until you put
something into it. So you have to get the user name from a user and
put it into the session variable.
correct. i do have the session variable ("username") as the login
name of the user. this gets assigned on the login page. the problem i
am having, is what to use on the asa page as the session("username")
so i can work with it there.
You can't. What do you want to do with it in global.asa? There are only
4 event procedures that run in global.asa: application_onstart,
application_onend, session_onstart, and session_onend.
The session_onstart event runs BEFORE that login page runs. The user's
name does not exist at this point. You have to assign it into the
session variable at the point that the login page gets it from the user.
>
i guess i am not explaining myself to well.

Session.SessionID

that is the actual session id of the user.
True
>

Session.UserName
i know this isn't the session("username")
True.
Unless you are creating an intranet application that uses Windows
Authentication, the login name has to be gotten from the user.* Unless
you've stored it in a cookie on the user's machine (not very reliable),
it will not be available in global.asa ... and even then, I am not sure
that non-session cookies are available to global.asa. I don't have time
right now to look it up, but you can read through the documentation
here:
http://msdn.microsoft.com/library/en...f33a651779.asp

Bob Barrows

* If you ARE using Windows Authentication with Anonymous Access
disabled, the username can be found in
Request.SessionVariables("LOGON_USER")
--
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don't check it very often. You will get a
quicker response by posting to the newsgroup.
Mar 19 '07 #8
You can't. What do you want to do with it in global.asa? There are only
4 event procedures that run in global.asa: application_onstart,
application_onend, session_onstart, and session_onend.
The session_onstart event runs BEFORE that login page runs. The user's
name does not exist at this point. You have to assign it into the
session variable at the point that the login page gets it from the user.
ok. then maybe i need to work this with a database. and grab the logon
username.

the only problem i can see, which may or may not be a problem, is removing
the name in the db once the session is closed.
i think i can write a code that checks the login time, and sets any name in
there to delete after the same time that the session expires.

Mar 19 '07 #9
Jeff wrote:
>You can't. What do you want to do with it in global.asa? There are
only 4 event procedures that run in global.asa: application_onstart,
application_onend, session_onstart, and session_onend.
The session_onstart event runs BEFORE that login page runs. The
user's name does not exist at this point. You have to assign it into
the session variable at the point that the login page gets it from
the user.

ok. then maybe i need to work this with a database. and grab the logon
username.

the only problem i can see, which may or may not be a problem, is
removing the name in the db once the session is closed.
i think i can write a code that checks the login time, and sets any
name in there to delete after the same time that the session expires.
Well, then, you will want to look at these articles:
http://www.aspfaq.com/show.asp?id=2491
http://classicasp.aspfaq.com/general...ion-onend.html

--
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don't check it very often. You will get a
quicker response by posting to the newsgroup.
Mar 19 '07 #10
thanks Bob,

I really appreciate it
Mar 19 '07 #11

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

303 posts views Thread by mike420 | last post: by
22 posts views Thread by bearophile | last post: by
6 posts views Thread by Markus Dehmann | last post: by
33 posts views Thread by Joerg Schuster | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.