Get label text when dropdownlist is changed

Discussion in 'ASP .Net' started by staeri@gmail.com, Nov 2, 2006.

  1. Guest

    I have a datagrid containing one TemplateColumn with a label
    (lblObjectID) and one TemplateColumn with a DropDownList.

    When the DropDownList is changed I want to capture the value in the
    TemplateColumn with the label. How can I do that?

    I'm using the following code:

    Private Sub ddContract_SelectedIndexChanged(ByVal sender As
    System.Object, ByVal e As System.EventArgs)

    Dim strContractID As String = CType(sender,
    DropDownList).SelectedItem.Value
    Dim strObjectID As String = ???

    End If

    Regards,

    S
    , Nov 2, 2006
    #1
    1. Advertising

  2. Try using ItemCommand event. If I am not mistaken, it should fire on the ddl
    selection change. Through the event's second parameter you can get to the
    item (row), from item to the cell with the label and FindControl on the
    cell.

    --
    Eliyahu Goldin,
    Software Developer & Consultant
    Microsoft MVP [ASP.NET]


    <> wrote in message
    news:...
    >I have a datagrid containing one TemplateColumn with a label
    > (lblObjectID) and one TemplateColumn with a DropDownList.
    >
    > When the DropDownList is changed I want to capture the value in the
    > TemplateColumn with the label. How can I do that?
    >
    > I'm using the following code:
    >
    > Private Sub ddContract_SelectedIndexChanged(ByVal sender As
    > System.Object, ByVal e As System.EventArgs)
    >
    > Dim strContractID As String = CType(sender,
    > DropDownList).SelectedItem.Value
    > Dim strObjectID As String = ???
    >
    > End If
    >
    > Regards,
    >
    > S
    >
    Eliyahu Goldin, Nov 2, 2006
    #2
    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. nick
    Replies:
    3
    Views:
    3,183
    Eliyahu Goldin
    Dec 15, 2004
  2. Praveen
    Replies:
    1
    Views:
    960
    Rob Williscroft
    Nov 5, 2006
  3. CSharpner
    Replies:
    0
    Views:
    1,013
    CSharpner
    Apr 9, 2007
  4. nick
    Replies:
    1
    Views:
    210
    Victor Garcia Aprea [MVP]
    Dec 23, 2004
  5. Knut Krueger
    Replies:
    8
    Views:
    263
    Knut Krueger
    Aug 20, 2013
Loading...

Share This Page