Re: How to capture SelectedIndexchanged event of dropdownlist in Datagrid

Discussion in 'ASP .Net' started by Shiva, Oct 31, 2004.

  1. Shiva

    Shiva Guest

    Use the OnSelectedIndexChanged attribute of the <asp:DropDownList> element
    to hook to your server-side event.


    In .aspx file:
    <asp:DropDownList id="ddl" runat=server
    OnSelectedIndexChanged="SelectionChanged" />

    In code-behind file:

    protected void SelectionChanged (object sender, EventArgs e)
    DropDownList d = (DropDownList)sender;
    // Use d here


    (Type your message here)

    From: Uma Shanmugam

    I have a datagrid and it has a dropdownlist in the Edit mode.I want to
    capture the selectedIndexChanged event of the dropdownlist. I tried
    ItemCommand event and then realised that it is fired when a button is
    clicked.Any help will be greatly appreciated.

    Thanks in Advance
    Uma Shanmugam
    Shiva, Oct 31, 2004
    1. Advertisements

  2. Shiva

    Guest Guest

    Hi Shiva,

    Yes, selectchanged is captured. But the SelectedItemIndex still remain
    without change. Any Idea?

    Guest, Feb 25, 2005
    1. Advertisements

  3. Shiva

    Jc Morin Guest

    Did you assign the value in the Page_Load event ? maybe you didn't set the
    routine in

    if (!IsPostBack) {


    so after postback the original value is re-apply before you read the value
    Jc Morin, Feb 25, 2005
  4. Shiva


    Jun 14, 2012
    Likes Received:
    did u set the autopostback to true ??

    <asp:DropDownList ID="ddlProductType" runat="server" AutoPostBack="true" OnSelectedIndexChanged="ddlProductType_SelectedIndexChanged">

    leoykl, Jun 14, 2012
    1. Advertisements

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 (here). After that, you can post your question and our members will help you out.