Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Listbox onSelectedIndexChanged event firing on Page Load

Reply
Thread Tools

Listbox onSelectedIndexChanged event firing on Page Load

 
 
=?Utf-8?B?UmVkR1NU?=
Guest
Posts: n/a
 
      03-15-2005
Hello,
Im somewhat new to asp.net, so bear with me.

I have created a form that has a Listbox along with 2 command buttons & a
few other non-important controls.

The command button is tied to the OnClick Event.

My problem is that when the command button is clicked, the Listbox
OnSelectedIndexChanged event gets fired before the command buttons OnClick
Event.
(I have validated the process through the debugger)

The PostBack process goes:
1. Page_Load
2. ListBox_OnSelectedIndexChanged
3. cmdSubmit_OnClick.

My Page_Load does nothing to change the listbox selections.

Also, when I first load the page, the OnSelectedIndexChanged event doesnt
get fired (which i figure to be correct) - so I figured this to be the same
as after the cmdSubmit button was pressed (since there is no activity
happening on the Listbox)

Here is my Page_Load code:

Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
' Add the javascript validation for the Delete
cmdDelete.Attributes.Add("onClick", "return confirmDelete();")

' This is only processed on initial page load.
If Not IsPostBack Then
SetUpHelpfulHints()
SetUpCalendars()
SetUpForm(0)
End If
End Sub.

Why is the listbox onSelectedIndexChange Event fired?
Even with that, why is it fired before the button's OnClick event?
 
Reply With Quote
 
 
 
 
Karl Seguin
Guest
Posts: n/a
 
      03-15-2005
Seems odd...could you simplify the page and include all the ASPX and
codebehind? My guess is that something in Init is wrongly hooked up....

Karl

--
MY ASP.Net tutorials
http://www.openmymind.net/ - New and Improved (yes, the popup is
annoying)
http://www.openmymind.net/faq.aspx - unofficial newsgroup FAQ (more to
come!)
"RedGST" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Hello,
> Im somewhat new to asp.net, so bear with me.
>
> I have created a form that has a Listbox along with 2 command buttons & a
> few other non-important controls.
>
> The command button is tied to the OnClick Event.
>
> My problem is that when the command button is clicked, the Listbox
> OnSelectedIndexChanged event gets fired before the command buttons OnClick
> Event.
> (I have validated the process through the debugger)
>
> The PostBack process goes:
> 1. Page_Load
> 2. ListBox_OnSelectedIndexChanged
> 3. cmdSubmit_OnClick.
>
> My Page_Load does nothing to change the listbox selections.
>
> Also, when I first load the page, the OnSelectedIndexChanged event doesnt
> get fired (which i figure to be correct) - so I figured this to be the

same
> as after the cmdSubmit button was pressed (since there is no activity
> happening on the Listbox)
>
> Here is my Page_Load code:
>
> Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
> System.EventArgs) Handles MyBase.Load
> ' Add the javascript validation for the Delete
> cmdDelete.Attributes.Add("onClick", "return confirmDelete();")
>
> ' This is only processed on initial page load.
> If Not IsPostBack Then
> SetUpHelpfulHints()
> SetUpCalendars()
> SetUpForm(0)
> End If
> End Sub.
>
> Why is the listbox onSelectedIndexChange Event fired?
> Even with that, why is it fired before the button's OnClick event?



 
Reply With Quote
 
 
 
Reply

Thread Tools

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 Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
firing button click event before page load event.....???? GauravGupta ASP .Net 4 01-19-2012 06:52 AM
OnSelectedIndexChanged event not firing on a DropDownList within a DataList Paul L ASP .Net 1 05-06-2005 12:12 AM
OnSelectedIndexChanged event not firing on a DropDownList within a DataList Paul L ASP .Net Web Controls 0 05-05-2005 08:58 PM
DropDownList - onSelectedIndexChanged not firing Jerry ASP .Net Web Controls 2 04-16-2004 02:02 PM
OnSelectedIndexChanged not firing Julie Barnet ASP .Net 2 08-21-2003 06:35 AM



Advertisments