Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. DropDownList's SelectedIndexChanged event is not triggered

DropDownList's SelectedIndexChanged event is not triggered

Scheduled Pinned Locked Moved ASP.NET
helpcsharpdatabasedesign
3 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • C Offline
    C Offline
    cpp_prgmer
    wrote on last edited by
    #1

    I read several posts online & verified the following: 1. AutoPostBack="true" 2. EnableViewState="True" (default) 3. CausesValidation = "False" (default) Also added the EnableViewState="true" on the page-level directive. Inspite of this I am unable to cause the SelectedIndexChanged event to trigger. I am using VS2010, VB.NET with no AJAX. I am populating my dropdownlist in the PageLoad event and on the condition If (Not IsPostback) Another issue is that my dropdownlist items are getting cleared on postback each time. So as a work around I added SQLDataSource on my aspx page and configured it as datasource to my dropdownlist and now the event is getting triggered properly, I am not sure why. I am new to VB.NET and web development and I feel I am missing something obvious, like taking into consideration Page events chronology, please suggest. Thanks for all your help in advance.

    <%@ Page Title="" Language="VB" MasterPageFile="~/MyMaster.master" AutoEventWireup="false" CodeFile="MyPage.aspx.vb" Inherits="MyPage" EnableViewState="true" %>

    Title

    Imports System.Data
    Imports System.Data.SqlClient
    Imports System.Configuration.ConfigurationManager

    Partial Class MyPage Inherits System.Web.UI.Page
    Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load
    If IsPostBack Then
    Exit Sub
    End If
    PopulateData()
    End Sub

    Private Sub PopulateData()
        Dim da As New SqlDataAdapter
         Dim ds1, ds2, ds3 As New DataSet
    
        Try
            Using
    
    P 1 Reply Last reply
    0
    • C cpp_prgmer

      I read several posts online & verified the following: 1. AutoPostBack="true" 2. EnableViewState="True" (default) 3. CausesValidation = "False" (default) Also added the EnableViewState="true" on the page-level directive. Inspite of this I am unable to cause the SelectedIndexChanged event to trigger. I am using VS2010, VB.NET with no AJAX. I am populating my dropdownlist in the PageLoad event and on the condition If (Not IsPostback) Another issue is that my dropdownlist items are getting cleared on postback each time. So as a work around I added SQLDataSource on my aspx page and configured it as datasource to my dropdownlist and now the event is getting triggered properly, I am not sure why. I am new to VB.NET and web development and I feel I am missing something obvious, like taking into consideration Page events chronology, please suggest. Thanks for all your help in advance.

      <%@ Page Title="" Language="VB" MasterPageFile="~/MyMaster.master" AutoEventWireup="false" CodeFile="MyPage.aspx.vb" Inherits="MyPage" EnableViewState="true" %>

      Title

      Imports System.Data
      Imports System.Data.SqlClient
      Imports System.Configuration.ConfigurationManager

      Partial Class MyPage Inherits System.Web.UI.Page
      Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load
      If IsPostBack Then
      Exit Sub
      End If
      PopulateData()
      End Sub

      Private Sub PopulateData()
          Dim da As New SqlDataAdapter
           Dim ds1, ds2, ds3 As New DataSet
      
          Try
              Using
      
      P Offline
      P Offline
      Parwej Ahamad
      wrote on last edited by
      #2

      You need to bind event "ddl_SelectedIndexChanged" with dropdown list.

      Parwej Ahamad

      C 1 Reply Last reply
      0
      • P Parwej Ahamad

        You need to bind event "ddl_SelectedIndexChanged" with dropdown list.

        Parwej Ahamad

        C Offline
        C Offline
        cpp_prgmer
        wrote on last edited by
        #3

        Thanks for the help. But in VB.NET the event handling happens in the code-behind using "Function Handles control.event" kind of signature. You can find that in the code I have posted in my original question.

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups