Wrox Programmer Forums
|
ASP.NET 1.0 and 1.1 Basics ASP.NET discussion for users new to coding in ASP.NET 1.0 or 1.1. NOT for the older "classic" ASP 3 or the newer ASP.NET 2.0.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 1.0 and 1.1 Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old September 17th, 2003, 09:06 AM
planoie's Avatar
Friend of Wrox
 
Join Date: Aug 2003
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts
Default

Not exactly. When you create a list (dropdown/listbox) all the items that are in it got stored in the page's viewstate. That's why if you were to have one line (listbox.Items.Add(...)) in page_load by itself, you'd see your list increase by one item with each postback.

So the list object is restored from the viewstate when you post back. Then the control figures out if you selected a different item by analyzing which item WAS selected (also in viewstate) and which is NOW selected (from Request.Form). So you then remove the selected item and the control save's its viewstate (now short one item) and redraws. Then the whole process starts over again. It all hinges on that hidden viewstate field.

I must admit, the way they have created event-driven, state-retaining forms on a web platform was quite creative.

Peter
 
Old September 17th, 2003, 09:27 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 1,110
Thanks: 0
Thanked 3 Times in 3 Posts
Default

Just curious... what books did you learn from?
 
Old September 17th, 2003, 09:57 AM
planoie's Avatar
Friend of Wrox
 
Join Date: Aug 2003
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts
Default

I learned a lot just from playing around. Much of the rudimentary programming theory I got at college. Most of the .Net knowledge I got from experimenting and reading the MSDN articles and help files. I do have the "Beginning ASP.Net w/ VB.Net v1.0" (Wrox ISBN: 1-861007-33-7). I was attempting to read it cover to cover, but only have gotten halfway thru. But I have referenced various bits of that. For the most part it's trial and error.

Peter
 
Old October 18th, 2003, 06:29 PM
Registered User
 
Join Date: Oct 2003
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to mahboula
Default

Hi,
  I am trying to generate a list of random numbers from a string array, but it keeps giving me repetitions in some instances. How do i prevent the array from generating the same random number twice?
Thanks. here is what i used and didn't work.


Dim namesArray() As String = {"a", "b", "c", "d", "e", "f", "g", "h", "i", "j"}
        Dim intRandom As Integer = Int(Rnd() * 10 + 1)
        Return namesArray(intRandom - 1)

 
Old October 20th, 2003, 01:22 PM
planoie's Avatar
Friend of Wrox
 
Join Date: Aug 2003
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts
Default

You need to either remember what you've already chosen or remove what you've already chosen from the select group.

Are you going to have to remember what's been selected between page hits or are you selecting a series of random values at once? If you need to remember between page hits it's a bit harder.

Peter





Similar Threads
Thread Thread Starter Forum Replies Last Post
Convering a String Array to an Integer array nkrust C# 9 November 17th, 2010 12:02 PM
Go from 2d Array to 1d array without defining type OneQuestion General .NET 1 January 10th, 2008 11:13 AM
Working with array-type elements tclotworthy XSLT 2 October 11th, 2007 09:27 AM
Working on Doc Array inside another Doc Array? chriscym XSLT 5 April 4th, 2007 05:56 AM
Passing php array values to javascript array gkrishna Pro PHP 0 November 6th, 2004 03:20 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.