Wrox Programmer Forums
|
ASP.NET 1.1 As of 10/6/2005, this forum is locked as part of the reorganization described here: http://p2p.wrox.com/topic.asp?TOPIC_ID=35394. No posts have been deleted. Open ongoing discussions from the last week have been moved to either ASP.NET 1.0 and 1.1 Beginners http://p2p.wrox.com/asp-net-1-0-1-1-basics-60/ or ASP.NET 1.0 and 1.1 Professional. http://p2p.wrox.com/forum.asp?FORUM_ID=50. See my sticky post inside for more.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 1.1 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 January 12th, 2005, 12:50 PM
Friend of Wrox
 
Join Date: Nov 2003
Posts: 1,348
Thanks: 0
Thanked 5 Times in 5 Posts
Default Trigger a System Event

Hello all,

  I have a dropdownlist on my form. I have some code that executes when the user clicks on it and selects a different value(SelectedIndexChanged Event). This works fine. Initally, when I enter the page, I set the value in this dropdown based on a session variable. However, when I do this, the SelectedIndexChanged Event doesn't fire like when a user changes the value. I would like this event to fire when the value is set programatically. I can't seem to find a way to fire this event manually. Is there a way to do this?

Thanks for the help.

Jim
 
Old January 12th, 2005, 06:02 PM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Probably the quickest way to do this is to call a separate method from the SelectedIndexChanged event (which is always a good idea) and use that same method in your own code:

Funcion SelectedIndex_Changed(Bla bla bla)
  DoMySelectedIndexChanged()
End Function

Private Sub Page_Load()
  DoMySelectedIndexChanged()
End Sub

Private Sub DoMySelectedIndexChanged()
  ' Do whatever you need to do here
End Sub

HtH,

Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
While typing this post, I was listening to: Schottkey 7th Path by Aphex Twin (Track 9 from the album: Selected Ambient Works 85-92) What's This?
 
Old January 12th, 2005, 06:34 PM
Friend of Wrox
 
Join Date: Nov 2003
Posts: 1,348
Thanks: 0
Thanked 5 Times in 5 Posts
Default

thanks that makes sense

I have found another way to do it.. but not sure if it is the best way.. your seems better

Thanks again!!!






Similar Threads
Thread Thread Starter Forum Replies Last Post
Does GridView trigger PageIndexChanged event? PeterPeiGuo ASP.NET 2.0 Basics 2 December 5th, 2008 07:39 PM
onmouseover trigger event JParent Javascript How-To 1 February 13th, 2006 10:26 AM
Trigger event on button click speedyH ASP.NET 1.x and 2.0 Application Design 3 June 27th, 2004 10:10 AM
Force an event to trigger YiannisF ASP.NET 1.0 and 1.1 Basics 2 June 2nd, 2004 08:52 AM
TRIGGER USING SYSTEM CLOCK reyboy SQL Server 2000 2 April 20th, 2004 12:43 AM





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