ItemIndex of add events

Discussion in 'ASP .Net Datagrid Control' started by Matt, Jun 30, 2003.

  1. Matt

    Matt Guest

    I created a datagrid with a footer that used to add a row. This worked
    for my other datagrids but this datagrid had two columns with
    dropdownlists in the footer. The first dropdownlist is supposed to
    trigger a change to the contents of the second dropdownlist.

    This works fine with an edit because I have EditItemIndex. But with an
    add I can't figure out how to get the right index. Here's what the
    logic looks like, I have one subroutine to handle the various
    dropdownlist changes:

    Protected Sub ddlTest_SelectedIndexChanged(ByVal sender As Object,
    ByVal e As System.EventArgs)
    Dim ddl As DropDownList = CType(sender, DropDownList)
    Dim aSqlParams As Array =
    Array.CreateInstance(GetType(SqlParameter), 1)
    Dim sName As String = ddl.ID

    Select Case sName
    Case "ddlOneAdd"
    '???
    Case "ddlOneEdit"
    aSqlParams.SetValue(New SqlParameter("@catid",
    ddl.SelectedItem.Value), 0)
    ddl =
    grdAllocation.Items(grdTest.EditItemIndex).Cells(1).FindControl("ddlTwoEdit")
    BindDropDownList(ddl, "sp_name", "value", "text",
    aSqlParams)
    End Select
    End Sub

    As I said, the Edit routine works because I can use
    grdTest.EditItemIndex to do my FindControl to get to the second
    dropdownlist.

    How can I get the correct index when the rows are in the footer and
    there isn't any corresponding index value to retrieve?
     
    Matt, Jun 30, 2003
    #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. Stephan

    e.Item.ItemIndex returns wrong value

    Stephan, Jul 26, 2004, in forum: ASP .Net
    Replies:
    3
    Views:
    3,477
    Stephan Bussing
    Jul 26, 2004
  2. brian yeo via .NET 247

    read row (1 field) from ItemIndex

    brian yeo via .NET 247, Mar 7, 2005, in forum: ASP .Net
    Replies:
    0
    Views:
    726
    brian yeo via .NET 247
    Mar 7, 2005
  3. Adam Knight

    DataList ItemIndex.

    Adam Knight, Sep 29, 2005, in forum: ASP .Net
    Replies:
    3
    Views:
    4,414
    intrader
    Sep 29, 2005
  4. DataGrid change ItemIndex

    , Jan 5, 2006, in forum: ASP .Net
    Replies:
    1
    Views:
    495
    S. Justin Gengo
    Jan 6, 2006
  5. Fred Dag
    Replies:
    1
    Views:
    2,036
    =?Utf-8?B?U2VyZ2V5IFBvYmVyZXpvdnNraXk=?=
    Jan 20, 2006
Loading...

Share This Page