»
 

Go Back   ResellerRatings Store Ratings > ResellerRatings Forums > Tech Support

Reply
 
LinkBack Thread Tools Display Modes
Old 04-24-2004, 05:14 PM   #1 (permalink)
Registered User
 
Tekk's Avatar
 
Join Date: Oct 2001
Location: SoCal
Posts: 1,122
Tekk is on a distinguished road
Defaulting to Zero in ASP.NET

Im creating a simple shopping cart application and Im wondering how I can get the text-boxes to default to 0 when the page is first viewed. I've been trying to play with the Page.IsPostBack but no matter what I do it wont recognize what I input. For instance right now I have the following block at the top of my aspx file:

[code]
Sub Page_Load
If Not Page.IsPostback Then
phone307.Text = Session("numCell307")
phone427.Text = Session("numCell427")
phone625.Text = Session("numCell625")
End If
End Sub
[code]


I've tried putting in an Else statement setting the .Text values to 0 but it wont work. Any idea on how to solve it?

__________________
Im very explosive right now...BOOM! Very explosive.
Tekk is offline   Reply With Quote
Old 04-24-2004, 05:21 PM   #2 (permalink)
Registered User
 
Tekk's Avatar
 
Join Date: Oct 2001
Location: SoCal
Posts: 1,122
Tekk is on a distinguished road
What Im trying to do is on the cart/checkout page I dont want to display anything if the cart is empty. Well I'll display a message saying the cart is empty but I think you get the idea. On the cart page i've tried the following code to see if it would work instead of setting values to "0"


If (Session("numCell307") != "") Then
....cart is empty.....
End If

Above gives me a compilation error

I've also tried assigning the value to something as in:

Dim qty307 As String = Session("numCell307")

If (CInt(qty307) > 0) Then
.....show contents.....
Else: nothing
End If

this one gives me an invalid cast because you cant cast a "" to an int (obviously). Although now that I think about it...I could just do it where:

Dim qty307 As String = Session("numCell307")

If (qty307 != "") Then
.....show contents.....
Else nothing
End if
__________________
Im very explosive right now...BOOM! Very explosive.
Tekk is offline   Reply With Quote
Old 04-24-2004, 05:28 PM   #3 (permalink)
Registered User
 
Tekk's Avatar
 
Join Date: Oct 2001
Location: SoCal
Posts: 1,122
Tekk is on a distinguished road
Well Im retarded and figured out my second post's problem:


If Not(qty307 = Nothing) then
..............
End if
__________________
Im very explosive right now...BOOM! Very explosive.
Tekk is offline   Reply With Quote
Old 04-26-2004, 01:58 AM   #4 (permalink)
Registered User
 
Tekk's Avatar
 
Join Date: Oct 2001
Location: SoCal
Posts: 1,122
Tekk is on a distinguished road
I'd just like to mention after finishin this little project Im doing with ASP.net that its lame. Maybe its just me, I dont know, but I find ASP.NET not as logical as say classic ASP or even JSP. And what is the big problem with jsp's anyway? Im taking a JSP class right now as well and man is that easy.....sure its a little bit slower but for me (maybe cause I've had more experience in java) its the EASIEST to code.
__________________
Im very explosive right now...BOOM! Very explosive.
Tekk is offline   Reply With Quote
Old 04-28-2004, 10:21 PM   #5 (permalink)
Registered User
 
Join Date: Sep 2002
Posts: 265
Creosote is on a distinguished road
The != operator does not exist in Visual Basic. Its <>. You were mixing C# style syntax with Visual Basic.

ASP.Net is way more logical than classic ASP. Its object oriented.

It would be sad if there were not many choices to code in for server based web languages.
Creosote is offline   Reply With Quote
Old 05-02-2004, 02:19 PM   #6 (permalink)
Registered User
 
Tekk's Avatar
 
Join Date: Oct 2001
Location: SoCal
Posts: 1,122
Tekk is on a distinguished road
I finally noticed that

!= also exists in java

It sometimes gets confusing when Im taking a VBScript class, a VB.NET class, and a JSP class......I get em all mixed!!!

Its gotta be the way the teacher is teaching it because he's making ASP.NET seem way more confusing than it probably needs to be. I agree that object oriented is 10x better

Here's a question: can you pass an arraylist in a session variable in asp.net? the few times I tried it I would successfully fill the arraylist, assign it to a session variable, but then when I try to get the session variable in the next page (ie Dim aList as ArrayList = Session("sessionList")) it returns a 0 count when there should be several things in it. Anyone work with arraylists in ASP.NET before?
__________________
Im very explosive right now...BOOM! Very explosive.

Last edited by Tekk; 05-02-2004 at 02:29 PM.
Tekk is offline   Reply With Quote
Old 05-02-2004, 04:48 PM   #7 (permalink)
Registered User
 
Join Date: Sep 2002
Posts: 265
Creosote is on a distinguished road
I have never tried it. But it should work. I have seen samples I believe where a DataSet was used as a session variable. A DataSet would more or less be similar to a collection.
Creosote is offline   Reply With Quote
Reply




Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Most Active Discussions

Recent Discussions

All times are GMT -6. The time now is 07:01 PM.