Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8243405
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T21:30:31+00:00 2026-06-07T21:30:31+00:00

This is a difficult scenerio to explain, so I coded up a simple example.

  • 0

This is a difficult scenerio to explain, so I coded up a simple example.

<asp:UpdatePanel runat="server" ID="upTest" ChildrenAsTriggers="true"
UpdateMode="Conditional">
  <ContentTemplate>
     <asp:DropDownList ID="ddlTest" runat="server" AutoPostBack="true"></asp:DropDownList>
     <br /><br /> 
     In page: <asp:TextBox runat="server" ID="txtTest" Columns="50" Text="OnLoad</asp:TextBox>
     <br />
     <br />
     <asp:Button runat="server" ID="btnTest" Text="Click it" />
  </ContentTemplate>
  <Triggers>
     <asp:AsyncPostBackTrigger ControlID="ddlTest" />
  </Triggers>
 </UpdatePanel>

Code-Behind

Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
    If Page.IsPostBack Then
        BindDropDown(Request.Form(ddlTest.UniqueID))
    Else
        BindDropDown(0)
    End If
End Sub

Public Sub BindDropDown(val As Integer)

    ddlTest.Items.Add(New ListItem("", 0))
    ddlTest.Items.Add(New ListItem("One", 1))
    ddlTest.Items.Add(New ListItem("Two", 2))
    ddlTest.Items.Add(New ListItem("Three", 3))
    ddlTest.Items.Add(New ListItem("Four", 4))
    ddlTest.SelectedValue = val

End Sub

Private Sub ddlTest_SelectedIndexChanged(sender As Object, e As System.EventArgs) Handles ddlTest.SelectedIndexChanged
    txtTest.Text = "Dropdown changed"
End Sub

Private Sub btnTest_Click(sender As Object, e As System.EventArgs) Handles btnTest.Click
    txtTest.Text = "Button clicked"
End Sub

Also to note, I have EnableViewState=”false” and ClientIdMode=”Static” for the page.

When I click the button the partial postback occurs and the textbox has the expected value of ‘Button Clicked’

When I change the dropdown the partial postback occurs, however the textbox does not have the expected value of ‘Dropdown changed’ because the code in ddlTest_SelectedIndexChanged is never hit (breakpoint placement on that line of code also never hits)

In the larger scope of my project this is the crux of the problem and I can’t determine why this event is never hit (the core problem is when I load a dynamic user control, the data in the control is bound correctly, but then is overridden with the pre-post data after the user control is loaded – the override is occurring somewhere in the post back events). It appears to me it has something to do with the binding of the dropdown and where it happens in the page cycle, but I haven’t been able to nail anything down, nor come up with google solutions.

One odd thing I did notice when looking at the post in Firebug – the EVENTTARGET value for the dropdown was the UniqueId of the dropdown, but the EVENTTARGET value is empty for the button click. My brain is thinking there is some connection here.

FYI – I have come up with a work around that seems to do the trick. I set autopostback on dropdown to false, and using jQuery I assign the change event on the dropdown to fire the button click – which causes the postback and fires btn_click event in code.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-07T21:30:33+00:00Added an answer on June 7, 2026 at 9:30 pm

    I solved the initial issue here by moving the dropdown fill to the init event and then letting .NET load the selected value from view state

    However in doing this, now the selectedindex event fires on EVERY postback.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This is going to be a bit difficult to explain. I'm usually fine with
This is difficult to track down for me as a JS newbie. I am
I'm not sure how difficult this but I have an array and would like
not sure why I find this so difficult. Here is the html code: <tr>
I'm new to regular expressions and i'm feeling this very difficult to solve: I
This might be difficult to answer. I am trying to understand some codebase and
I know this question is difficult to understand but I need a mathematical equation
This should'nt be that difficult but for some reason i'm having trouble with this.
difficult to look this up if it has been asked previously since I don't
This is a group assignment and it's become rather difficult to the point our

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.