Postback Confusion

W

William_Woods

The goal is to have a new web page called from a dropdown component.

HTML:
<asp:dropdownlist id="drpPacer" runat="server" ForeColor="Navy" Width
="372px" AutoPostBack="True"></asp:dropdownlist>

In the aspx.vb file, the list is bound to a command that fills the list
value with the URL to be invoked. I want it invoked whenever the
SelectedIndex property changes on the list.

Private Sub drpPacer_SelectedIndexChanged(ByVal sender As Object, ByVal
e As System.EventArgs) Handles drpPacer.SelectedIndexChanged
If drpPacer.SelectedIndex <> 0 Then
Response.Redirect(RTrim(drpPacer.SelectedItem.Value))
End If
End Sub

The 0 item is just a placeholder.

This works fine so long as there's only one of this type dropdown list on
the page or simply one server side component with postback activity on the
page. When I add, for instance, a calendar with a SelectionChanged event
handler, the dropdown list is always the only server side component
processed; the calendar event is not processed and I'm redirected to the
correct URL. The Redirect to the selected web site is always performed no
matter if the postback was motivated by the calendar or the dropdown list
changing.

Is there someway on a postback to only process the server side component
that actually activated the post? I really don't want to resort a client
side solution. Rather stay native ASP.Net. Thanks for any help with
Postback.
 
J

jef

The goal is to have a new web page called from a dropdown component.

HTML:
<asp:dropdownlist id="drpPacer" runat="server" ForeColor="Navy" Width
="372px" AutoPostBack="True"></asp:dropdownlist>

In the aspx.vb file, the list is bound to a command that fills the list
value with the URL to be invoked. I want it invoked whenever the
SelectedIndex property changes on the list.

Private Sub drpPacer_SelectedIndexChanged(ByVal sender As Object, ByVal
e As System.EventArgs) Handles drpPacer.SelectedIndexChanged
If drpPacer.SelectedIndex <> 0 Then
Response.Redirect(RTrim(drpPacer.SelectedItem.Value))
End If
End Sub

The 0 item is just a placeholder.

This works fine so long as there's only one of this type dropdown list on
the page or simply one server side component with postback activity on the
page. When I add, for instance, a calendar with a SelectionChanged event
handler, the dropdown list is always the only server side component
processed; the calendar event is not processed and I'm redirected to the
correct URL. The Redirect to the selected web site is always performed no
matter if the postback was motivated by the calendar or the dropdown list
changing.

Is there someway on a postback to only process the server side component
that actually activated the post? I really don't want to resort a client
side solution. Rather stay native ASP.Net. Thanks for any help with
Postback.

This is strange - you're event handler shouldn't be called unless your
DropDownList is raising that specific event.

Is there any chance you could post all the code for the page?

jef
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,770
Messages
2,569,584
Members
45,075
Latest member
MakersCBDBloodSupport

Latest Threads

Top