SelectedIndexChanged event does not fire?

Discussion in 'ASP .Net' started by Jim, Mar 8, 2005.

  1. Jim

    Jim Guest

    Hi All,



    Can someone tell me why the SelectedIndexChanged event does not fire?



    <form id="Form1" method="post" runat="server">

    <asp:Table id="Table1" runat="server" Width="455px" Height="61px">

    <asp:TableRow>

    <asp:TableCell>

    <asp:DropDownList id="DropDownList1" runat="server" Width="263px"
    AutoPostBack="True">

    <asp:ListItem Value="bef">bef</asp:ListItem>

    <asp:ListItem Value="kut">kut</asp:ListItem>

    </asp:DropDownList>

    </asp:TableCell>

    </asp:TableRow>

    </asp:Table>

    </form>






    private void DropDownList1_SelectedIndexChanged(object sender,
    System.EventArgs e)

    {

    Response.Write("it works!"); //no way!!



    }



    ch Jim
    Jim, Mar 8, 2005
    #1
    1. Advertising

  2. Jim

    Karl Seguin Guest

    Where is the evnet hooked?
    Since you aren't explicitely showing it and your method is private, make
    sure this.DropDownList1.SelectedIndexChange +=
    this.DropDownList1_SelectedIndexChanged; is in the onInit

    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!)


    "Jim" <> wrote in message
    news:...
    > Hi All,
    >
    >
    >
    > Can someone tell me why the SelectedIndexChanged event does not fire?
    >
    >
    >
    > <form id="Form1" method="post" runat="server">
    >
    > <asp:Table id="Table1" runat="server" Width="455px" Height="61px">
    >
    > <asp:TableRow>
    >
    > <asp:TableCell>
    >
    > <asp:DropDownList id="DropDownList1" runat="server" Width="263px"
    > AutoPostBack="True">
    >
    > <asp:ListItem Value="bef">bef</asp:ListItem>
    >
    > <asp:ListItem Value="kut">kut</asp:ListItem>
    >
    > </asp:DropDownList>
    >
    > </asp:TableCell>
    >
    > </asp:TableRow>
    >
    > </asp:Table>
    >
    > </form>
    >
    >
    >
    >
    >
    >
    > private void DropDownList1_SelectedIndexChanged(object sender,
    > System.EventArgs e)
    >
    > {
    >
    > Response.Write("it works!"); //no way!!
    >
    >
    >
    > }
    >
    >
    >
    > ch Jim
    >
    >
    Karl Seguin, Mar 8, 2005
    #2
    1. Advertising

  3. Jim

    Damon Payne Guest

    In your code behind, is the DropDownList1_SelectedIndexChanged method
    assigned to DropDownList1's IndexChanged event? It needs to be either in the
    code behind or in the ASPX page

    --
    ------------------------------------------
    Damon Payne
    http://www.damonpayne.com
    "Jim" <> wrote in message
    news:...
    > Hi All,
    >
    >
    >
    > Can someone tell me why the SelectedIndexChanged event does not fire?
    >
    >
    >
    > <form id="Form1" method="post" runat="server">
    >
    > <asp:Table id="Table1" runat="server" Width="455px" Height="61px">
    >
    > <asp:TableRow>
    >
    > <asp:TableCell>
    >
    > <asp:DropDownList id="DropDownList1" runat="server" Width="263px"
    > AutoPostBack="True">
    >
    > <asp:ListItem Value="bef">bef</asp:ListItem>
    >
    > <asp:ListItem Value="kut">kut</asp:ListItem>
    >
    > </asp:DropDownList>
    >
    > </asp:TableCell>
    >
    > </asp:TableRow>
    >
    > </asp:Table>
    >
    > </form>
    >
    >
    >
    >
    >
    >
    > private void DropDownList1_SelectedIndexChanged(object sender,
    > System.EventArgs e)
    >
    > {
    >
    > Response.Write("it works!"); //no way!!
    >
    >
    >
    > }
    >
    >
    >
    > ch Jim
    >
    >
    Damon Payne, Mar 8, 2005
    #3
  4. Jim

    Jim Guest

    thanks Carl and Damon for the solution!

    ch Jim
    "Damon Payne" <> schreef in bericht
    news:XY8Xd.21315$-kc.rr.com...
    > In your code behind, is the DropDownList1_SelectedIndexChanged method
    > assigned to DropDownList1's IndexChanged event? It needs to be either in
    > the
    > code behind or in the ASPX page
    >
    > --
    > ------------------------------------------
    > Damon Payne
    > http://www.damonpayne.com
    > "Jim" <> wrote in message
    > news:...
    >> Hi All,
    >>
    >>
    >>
    >> Can someone tell me why the SelectedIndexChanged event does not fire?
    >>
    >>
    >>
    >> <form id="Form1" method="post" runat="server">
    >>
    >> <asp:Table id="Table1" runat="server" Width="455px" Height="61px">
    >>
    >> <asp:TableRow>
    >>
    >> <asp:TableCell>
    >>
    >> <asp:DropDownList id="DropDownList1" runat="server" Width="263px"
    >> AutoPostBack="True">
    >>
    >> <asp:ListItem Value="bef">bef</asp:ListItem>
    >>
    >> <asp:ListItem Value="kut">kut</asp:ListItem>
    >>
    >> </asp:DropDownList>
    >>
    >> </asp:TableCell>
    >>
    >> </asp:TableRow>
    >>
    >> </asp:Table>
    >>
    >> </form>
    >>
    >>
    >>
    >>
    >>
    >>
    >> private void DropDownList1_SelectedIndexChanged(object sender,
    >> System.EventArgs e)
    >>
    >> {
    >>
    >> Response.Write("it works!"); //no way!!
    >>
    >>
    >>
    >> }
    >>
    >>
    >>
    >> ch Jim
    >>
    >>

    >
    >
    Jim, Mar 8, 2005
    #4
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Replies:
    0
    Views:
    1,661
  2. akhzar
    Replies:
    1
    Views:
    719
    akhzar
    Mar 6, 2009
  3. Brad

    Datagrid SelectedIndexChanged Does Not Fire

    Brad, Nov 25, 2003, in forum: ASP .Net Web Controls
    Replies:
    0
    Views:
    123
  4. Jim

    SelectedIndexChanged event does not fire

    Jim, Mar 8, 2005, in forum: ASP .Net Web Controls
    Replies:
    3
    Views:
    128
    steve-o
    Mar 8, 2005
  5. Taoge

    Dropdownlist SelectedIndexChanged does not fire?

    Taoge, Aug 21, 2006, in forum: ASP .Net Web Controls
    Replies:
    0
    Views:
    100
    Taoge
    Aug 21, 2006
Loading...

Share This Page