|
-
Apr 9th, 2005, 11:51 AM
#1
Thread Starter
PowerPoster
automatic calc?
Hi there. Creating an ASP.NET app.
basically, if a user selects an item from the drop down box, i want it to automatically do some simple calcs and display it in a textbox or label.
how can i do this, without the user clicking a button and doing the calculations? is there an automatic way of executing a command when the user has selected an item?
thanks
-
Apr 9th, 2005, 12:00 PM
#2
Not NoteMe
Re: automatic calc?
You could use the DropDownList web control, making use of its SelectedIndexChanged event.
Quotes:
"I am getting better then you guys.." NoteMe, on his leet english skills.
"And I am going to meat her again later on tonight." NoteMe
"I think you should change your name to QuoteMe" Shaggy Hiker, regarding NoteMe
"my sweet lord jesus. I've decided never to have breast implants" Tom Gibbons
Have I helped you? Please Rate my posts. 
-
Apr 9th, 2005, 12:01 PM
#3
Thread Starter
PowerPoster
Re: automatic calc?
i am using the dropdownlist but then what do i do?? data in that dropdown list is being filled in when the page is loading, it gets the data from a database
-
Apr 9th, 2005, 01:29 PM
#4
Not NoteMe
Re: automatic calc?
I don't use visual studio to develop asp.net project's (and can't run it), but i guess it's similar.
If you select the dropdownbox (in the design mode when you place it on the page) somewhere in the IDE there should be a list of its properties etc.
Near there will probably be a button to show its events. This will be a list (in place of its properties) listing the various events of the control you can assign functions to. One of these is the SelectedIndexChanged event. I think you can double click on this event and it'll automatically create a function for it, and set it up so that when the event fires the newly created function will run.
You put your calculation code in that function.
Quotes:
"I am getting better then you guys.." NoteMe, on his leet english skills.
"And I am going to meat her again later on tonight." NoteMe
"I think you should change your name to QuoteMe" Shaggy Hiker, regarding NoteMe
"my sweet lord jesus. I've decided never to have breast implants" Tom Gibbons
Have I helped you? Please Rate my posts. 
-
Apr 10th, 2005, 05:34 AM
#5
Addicted Member
Re: automatic calc?
You must set the AutoPostBack property of the dropdownlist to True. It will then postback to the server when the user selects an item from the list, and you can use the SelectedIndexChanged event to do the calculations.
-
Apr 10th, 2005, 09:42 AM
#6
Retired VBF Adm1nistrator
Re: automatic calc?
One could also do it entirely client-side through VBScript or JavaScript
Microsoft MVP : Visual Developer - Visual Basic [2004-2005]
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|