DataGrid DropDownList proble

Discussion in 'ASP .Net Web Controls' started by BJF, May 3, 2004.

  1. BJF

    BJF Guest

    How do you know what row you're getting changes for? Here's the issue:

    - It's a web application
    - I have a dropdown list in a column of my datagrid. The datagrid does
    AutoPostBack.
    - The dropdown list is defined in an ItemTemplate, not an EditItemTemplate.
    This is inside a TemplateColumn.
    - I databind it to a DataTable. All the data shows up as expected, the
    DropDownList is set to the proper value, and has the proper items available
    for selection in its list available for selection.
    - When the user selects a new value for one of the dropdownlists, the page
    is redisplayed (correctly) with the changed value in the dropdownlist
    control. In the event handler for the SelectedIndexChanged event I can
    determine the SelectedIndex for the newly selected item in the dropdownlist.
    So far, so good. (I find it interesting that, although the
    SelectedIndexChanged event is the one for the DataGrid, the 'sender' the
    event handler receives is the DropDownList object, not the DataGrid object.)

    What I can't determine is what row this particular DropDownList belongs
    to.

    Now, every example I've seen shows edited controls in an
    EditItemTemplate instead of an ItemTemplate, and it may be that this is the
    source of my problem. But these examples also require a click of an Edit
    link to show the EditItemTemplate instead of the ItemTemplate. My goal is
    to eliminate the need for this mouse click by just having the DropDownList
    show up in the ItemTemplate.
    Everything is working except the inability to know which row is being
    affected.

    Does anyone know how to do this, or if it's even possible?

    Thanks in advance,
    Ben Furino
     
    BJF, May 3, 2004
    #1
    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. aa

    proble with web.config

    aa, Dec 23, 2003, in forum: ASP .Net
    Replies:
    1
    Views:
    542
    Kevin Spencer
    Dec 23, 2003
  2. Andrew
    Replies:
    2
    Views:
    345
    Andrew
    Sep 3, 2004
  3. John M

    proble on using visual studio

    John M, May 12, 2005, in forum: ASP .Net
    Replies:
    0
    Views:
    366
    John M
    May 12, 2005
  4. rvino

    proble with substitution

    rvino, Aug 23, 2007, in forum: Perl
    Replies:
    0
    Views:
    2,149
    rvino
    Aug 23, 2007
  5. Sanny

    Socket .readLine() proble.

    Sanny, Oct 4, 2007, in forum: Java
    Replies:
    12
    Views:
    9,863
    Gordon Beaton
    Oct 8, 2007
Loading...

Share This Page