M
Matt
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?
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?