variables usage in aspx page
Messages   Related Types
This message was discovered on ASPFriends.com 'ngfx-odbc' list.


ANGELA G HOLDER-PEARMAN
-- Moved from [aspngfreeforall] to [ngfx-odbc] by Clint Barton <Click here to reveal e-mail address> --

Hi,
I'm new to ASP.NET, so please 'explain it to me like I'm a six-year-old'.
I'm using VB, creating an aspx page which connects to an Access DB. All is well so
far. In my <script> section, I connect to the DB to get just one record, then using
oledbdatareader, get the values of some columns and put those values in variables
defined earlier:

     Do While myreader.Read()
    
     varblocklot = myreader.getString(0)
     varbilling_yr = myreader.getstring(1)
     varreceipt = myreader.getstring(2)
     varyrrec = myreader.getint32(3)
                If myreader.isdbnull(43) then
                     varhold = 0
                 Else
                     varhold = myreader.getdouble(43)
                 End if
     Loop

Now I've got variables loaded like I want them. I've also bound to a datalist and am
trying to use that to display my data. Would like to take my variables and use them in
the datalist. So I can format my page there.
After I leave the <script> section of the page, I don't seem to have access to my
variables. Or my syntax is wrong.....
Or maybe there's a much better way to do this whole thing....

My goal is to be able to get my data record, then depending on the values in some
fields, control the display of some fields. For example, if field A is this, then display
X.....but if field A is that, then display Y. Also need to be able to say, if field D is
this,
then display field E, but if field D is that, then display field F.

Any help would be greatly appreciated,
Angela

Reply to this message...
 
    
Daniel Naumann
Hi Angela,

Hmmmm, not sure why you've been moved to the odbc list since you're not using
odbc, but anyway.............

I personally never to do any (vb) coding in the aspx page, I do all my coding in
the aspx.vb (code behind) page. I think it's a better way to do it and I think
most people agree. but if you're only just learning them you do which ever you
find easier to start with.

I'm a little unclear on you actual problem......... If you could post the
entire aspx page code then that might help. You say that after the <script>
tags you can't access you variables - you must be in those tags to access vb
variables.

As for the condition display it sounds like you need a series of 'If Then' or
'Select Case' statements. but I can't really help with that too much until I
know from where you're getting you A values and where your X and Y values will
go....

Daniel.

-----Original Message-----
From: ANGELA G HOLDER-PEARMAN [mailto:Click here to reveal e-mail address]
Sent: 04-Jun-2002 10:25
To: ngfx-odbc
Subject: [ngfx-odbc] variables usage in aspx page

-- Moved from [aspngfreeforall] to [ngfx-odbc] by Clint Barton
<Click here to reveal e-mail address> --

Hi,
I'm new to ASP.NET, so please 'explain it to me like I'm a six-year-old'.
I'm using VB, creating an aspx page which connects to an Access DB. All is well
so
far. In my <script> section, I connect to the DB to get just one record, then
using
oledbdatareader, get the values of some columns and put those values in
variables
defined earlier:

     Do While myreader.Read()

     varblocklot = myreader.getString(0)
     varbilling_yr = myreader.getstring(1)
     varreceipt = myreader.getstring(2)
     varyrrec = myreader.getint32(3)
                If myreader.isdbnull(43) then
                     varhold = 0
                 Else
                     varhold = myreader.getdouble(43)
                 End if
     Loop

Now I've got variables loaded like I want them. I've also bound to a datalist
and am
trying to use that to display my data. Would like to take my variables and use
them in
the datalist. So I can format my page there.
After I leave the <script> section of the page, I don't seem to have access to
my
variables. Or my syntax is wrong.....
Or maybe there's a much better way to do this whole thing....

My goal is to be able to get my data record, then depending on the values in
some
fields, control the display of some fields. For example, if field A is this,
then display
X.....but if field A is that, then display Y. Also need to be able to say, if
field D is
this,
then display field E, but if field D is that, then display field F.

Any help would be greatly appreciated,
Angela

| [ngfx-odbc] member Click here to reveal e-mail address = YOUR ID
| http://www.aspfriends.com/aspfriends/ngfx-odbc.asp = JOIN/QUIT

Reply to this message...
 
    
Pierre Thomasius
Hi Angela,

I think you need to use the <asp:label> tag because you can assign the text
property of it in your <script> block.
something like:
<script>
data access here

    If varblocklot = ??? Then
        Label1.Text = varblocklot
    else If varblocklot = !!! Then
        Label1.Text = varbilling_yr
    End If
</script>
then inside body tag have a label with "id=Label1"

So much for your displaying the result, but i must admit the way you are
getting your data into the variables seems complicated and if you only
expect one record why a "Do while" loop?

Maybe i can help more after you post some more code.

Pierre

-----Original Message-----
From: ANGELA G HOLDER-PEARMAN [mailto:Click here to reveal e-mail address]
Sent: 04 June 2002 13:25
To: ngfx-odbc
Subject: [ngfx-odbc] variables usage in aspx page

-- Moved from [aspngfreeforall] to [ngfx-odbc] by Clint Barton
<Click here to reveal e-mail address> --

Hi,
I'm new to ASP.NET, so please 'explain it to me like I'm a six-year-old'.
I'm using VB, creating an aspx page which connects to an Access DB. All is
well so
far. In my <script> section, I connect to the DB to get just one record,
then using
oledbdatareader, get the values of some columns and put those values in
variables
defined earlier:

     Do While myreader.Read()

     varblocklot = myreader.getString(0)
     varbilling_yr = myreader.getstring(1)
     varreceipt = myreader.getstring(2)
     varyrrec = myreader.getint32(3)
                If myreader.isdbnull(43) then
                     varhold = 0
                 Else
                     varhold = myreader.getdouble(43)
                 End if
     Loop

Now I've got variables loaded like I want them. I've also bound to a
datalist and am
trying to use that to display my data. Would like to take my variables and
use them in
the datalist. So I can format my page there.
After I leave the <script> section of the page, I don't seem to have access
to my
variables. Or my syntax is wrong.....
Or maybe there's a much better way to do this whole thing....

My goal is to be able to get my data record, then depending on the values in
some
fields, control the display of some fields. For example, if field A is
this, then display
X.....but if field A is that, then display Y. Also need to be able to say,
if field D is
this,
then display field E, but if field D is that, then display field F.

Any help would be greatly appreciated,
Angela

| [ngfx-odbc] member Click here to reveal e-mail address = YOUR ID
| http://www.aspfriends.com/aspfriends/ngfx-odbc.asp = JOIN/QUIT

Reply to this message...
 
    
Clint Barton
Lets continue this on
http://www.aspfriends.com/aspfriends/ngfx-oledb.asp
where this message was supposed to go before I pressed wrong button

sorry for my original mistake

----- Original Message -----
From: "Pierre Thomasius" <Click here to reveal e-mail address>
To: Click here to reveal e-mail address
Sent: Wed, 5 Jun 2002 10:14:00 +0100
Subject: RE: [ngfx-odbc] variables usage in aspx page
[Original message clipped]

Sent: 04 June 2002 13:25
To: ngfx-odbc
Subject: [ngfx-odbc] variables usage in aspx page
[Original message clipped]

Reply to this message...
 
    
ANGELA G HOLDER-PEARMAN
Hi all,
Thanks for the replies. I figured out yesterday that I could set the value of my variable
in the <script> section of the page, then in the datalist section, where I wanted to
display the results, I could do this:
    <ASP:Datalist id="thedata" runat="server">
    <%# Owner2%><br>
    etc....
Where Owner2 is a variable I set earlier.

Seems to work ok. Not sure it's the best way.
I did also work some with using <asp:label>, but then everything is stuck in the
<script>section of the page.
Thanks again,
Angela

From:     "Clint Barton" <Click here to reveal e-mail address>
To:     "ngfx-odbc" <Click here to reveal e-mail address>
Subject:     [ngfx-odbc] RE: variables usage in aspx page
Date sent:     Wed, 5 Jun 2002 05:53:07 -0400
Send reply to:     "ngfx-odbc" <Click here to reveal e-mail address>

[Original message clipped]

Reply to this message...
 
 




Ad
MBR BootFX
Best-of-breed application framework for .NET projects, developed by Matthew Baxter-Reynolds and MBR IT
 
 Copyright © Matthew Baxter-Reynolds 2001-2008. '.NET 247 Software Development Services' is a trading style of MBR IT Solutions Ltd.
Contact Us - Terms of Use - Privacy Policy - www.dotnet247.com