Results 1 to 2 of 2

Thread: (datagrid) Retrieve the selected value (template dropdown control)

  1. #1

    Thread Starter
    New Member
    Join Date
    Jul 2002
    Location
    Montreal
    Posts
    4

    (datagrid) Retrieve the selected value (template dropdown control)

    I have a template column with a dropdown control (in a datagrid).

    I have AutoPostBack set to TRUE because I need to update a file when a selection has changed.

    My question:

    How to retrieve the selected value when posted back in the code behind? not knowing witch DDL was changed.

    Here is the template code if it can help.
    Thanks,



    <asp:TemplateColumn>
    <ItemTemplate>
    <aspropDownList AutoPostBack=True id=DropDownList1 runat="server" SelectedIndex='<%# GetSelIndex(Container.DataItem("id")) %>' DataSource="<%#
    GetUserType() %>" DataTextField="value" DataValueField="id">
    </aspropDownList>
    </ItemTemplate>
    </asp:TemplateColumn>

  2. #2
    C# Aficionado Lord_Rat's Avatar
    Join Date
    Sep 2001
    Location
    Cave
    Posts
    2,497
    You need to make an event handler for the drop down list.

    EG:
    Code:
        Public Sub Task_Changed(ByVal sender As Object, ByVal e As EventArgs) Handles cboGroup.SelectedIndexChanged
    Response.write sender.Items(sender.SelectedIndex).Value
        End Sub
    Make the HANDLES handle one of your drop down lists, but after that, you can send the SelectedIndexChanged event of ANY drop down to that same function.
    Need to re-register ASP.NET?
    C:\WINNT\Microsoft.NET\Framework\v#VERSIONNUMBER#\aspnet_regiis -i

    (Edit #VERSIONNUMBER# as needed - do a DIR if you don't know)

Posting Permissions

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



Click Here to Expand Forum to Full Width