2013-03-15 64 views
0

我试图在编辑模式下使用Gridview中的Dropdownlist执行回发。我遇到了问题,下降的价值。我无法在RowDatabound事件中执行此操作。在GridView编辑模式下,在DropDownList_SelectedIndexChanged事件中访问dropdownlist的值

回写没有结束写入行,我正在进入DropDownList7_SelectedIndexChanged事件,我想执行一些操作,所以它甚至没有得到那里。我在页面加载事件中有If Post。

Protected Sub DropDownList7_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) 

    Dim row As GridViewRow = DirectCast(GridView1.Rows.Item(0), GridViewRow) 
    Dim newNumDDL As DropDownList = row.Cells(0).FindControl("DropDownList7") 


    Dim newVal As Integer = newNumDDL.SelectedValue 
    Dim newKey As String = newNumDDL.SelectedItem.ToString 
    Dim newindex As Integer = newNumDDL.SelectedIndex 

问题我相信是用findcontrol我找不到DDL,一直没有回来。

感谢您的任何帮助。

回答

2

你能不能用:

Dim newNumDDL As DropDownList = DirectCast(sender, DropDownList) 
+0

我知道这是简单的,脑死亡周五!谢谢!!! – htm11h 2013-03-15 15:47:53

相关问题