SelectedIndexChanged event is not fired

Ask a Question related to ASP.NET Building Controls, Design and Development.

  1. #1

    Default SelectedIndexChanged event is not fired

    I've created a Web user control that contains a DropDownList and this
    DropDownList gets created and loaded in init() everytime. I set
    AutoPostBack=true and registered the event.

    I'm using the same user control at 2 different places. When running in the
    ASP.NET web form, the DropDownList is working fine and the
    SelectedIndexChanged event handler does get called, but when running the
    same user control in my Sharepoint Web part page, the event never gets
    fired.

    Has anyone out there had similar problem (not necessarily to be Sharepoint
    related) that SelectedIndexChanged is not firing? Any possible reasons? It
    definitely does a post back just the event is not firing.

    Thanks in advance.

    Jingmei Li
    Bentley Systems Inc.



    BentleyInc Guest

  2. Similar Questions and Discussions

    1. cannot trigger SelectedIndexChanged event
      I use data binding function to display data from DB to datagrid. but I don't know why I cannot trigger the SelectedIndexChanged event?
    2. SelectedIndexChanged event not firing
      Is the AutoPostBack property of the DropDown set to True? -- HTH, Kevin Spencer Microsoft MVP ..Net Developer http://www.takempis.com...
    3. SelectedIndexChanged event in DropDownList
      Hi. Why cannot I capture the SelectedIndexChanged event from a DropDownList when the viewstate is set to false (it must be set to false because of...
    4. add Javascript code at the end of a SelectedIndexChanged event
      I have a webform that searches a database and displays the output in a datagrid. I would like to be able to call a javascript at the end of the...
    5. Dropdownlist SelectedIndexChanged event problem
      I am trying to get the newly selected item in the dropdownlist control from the SelectedIndexChanged event. The event is working fine, but I am...
  3. #2

    Default Re: SelectedIndexChanged event is not fired

    Please provide your code.
    Difficult to help without it.

    Henri

    "BentleyInc" <BentleyInc@online.nospam> a écrit dans le message de
    news:%23VsfS4u3EHA.208@TK2MSFTNGP12.phx.gbl...
    > I've created a Web user control that contains a DropDownList and this
    > DropDownList gets created and loaded in init() everytime. I set
    > AutoPostBack=true and registered the event.
    >
    > I'm using the same user control at 2 different places. When running in the
    > ASP.NET web form, the DropDownList is working fine and the
    > SelectedIndexChanged event handler does get called, but when running the
    > same user control in my Sharepoint Web part page, the event never gets
    > fired.
    >
    > Has anyone out there had similar problem (not necessarily to be Sharepoint
    > related) that SelectedIndexChanged is not firing? Any possible reasons? It
    > definitely does a post back just the event is not firing.
    >
    > Thanks in advance.
    >
    > Jingmei Li
    > Bentley Systems Inc.
    >
    >
    >
    >


    Henri Guest

  4. #3

    Default RE: SelectedIndexChanged event is not fired

    My guess is it may be a kind of name conflict -- same id is used somewhere.

    "BentleyInc" wrote:
    > I've created a Web user control that contains a DropDownList and this
    > DropDownList gets created and loaded in init() everytime. I set
    > AutoPostBack=true and registered the event.
    >
    > I'm using the same user control at 2 different places. When running in the
    > ASP.NET web form, the DropDownList is working fine and the
    > SelectedIndexChanged event handler does get called, but when running the
    > same user control in my Sharepoint Web part page, the event never gets
    > fired.
    >
    > Has anyone out there had similar problem (not necessarily to be Sharepoint
    > related) that SelectedIndexChanged is not firing? Any possible reasons? It
    > definitely does a post back just the event is not firing.
    >
    > Thanks in advance.
    >
    > Jingmei Li
    > Bentley Systems Inc.
    >
    >
    >
    >
    ComSpex Guest

  5. #4

    Default Re: SelectedIndexChanged event is not fired

    How I do it:

    1. Put the control on the ascx

    <asp:DropDownList runat="server" ID="DrpNiveau"></asp:DropDownList>

    2. Declare the control in the usercontrol class (Not as new! it already exsists) Use the Id above exactly as the name in the declaration
    protected DropDownList DrpNiveau;

    3. Add the event to the OnInit
    Set the Autopostback of the control to true


    protected override void OnInit(EventArgs e)
    {
    DrpNiveau.SelectedIndexChanged += DrpNiveau_SelectedIndexChanged;
    DrpNiveau.AutoPostBack = true;
    }

    4. Add the event to the class:

    protected void DrpNiveau_SelectedIndexChanged(object sender, EventArgs e)
    {

    }
    Unregistered Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139