No, that still didn't work. Any other suggestions?
I ended up with this
Sub DataGrid_Edit(ByVal Sender As Object, ByVal E As
DataGridCommandEventArgs)
' turn on editing for the selected row
Dim ddl As DropDownList = CType(E.Item.FindControl("drpNameType"),
DropDownList)
If Not isEdit Then
dg1.EditItemIndex = E.Item.ItemIndex
BindGrid()
End If
End Sub
Using a breakpoint, I see ddl = Nothing. What am I doing wrong here? Thanks!
"Phillip Williams" <Ph**************@webswapp.com> wrote in message
news:B6**********************************@microsof t.com...
Within the method that handles the datagrid EditCommand event you can get
a
reference to the dropdown list by using the passed
DataGridCommandEventArgs
as follows:
CType(e.Item.FindControl("controlname"), DropDownList)
--
http://www.webswapp.com
http://www.societopia.net
"Chris Kettenbach" wrote:
Good Morning,
Quick question, I have an EditItemTemplate inside a datagrid. It should
contain a drop down list of possible choices. I have an
EditCommandColumn.
The drop dow list column should initially contain the value of the field.
This works fine with
<ItemTemplate><%# Container.DataItem("NameType")%></ItemTemplate>
The desired effect is for the drop down list to databind to a query to
show
possible choices when the user clicks the edit link. I can not get a
reference to the drop down list when the user clicks edit. Does anyone
know
how to do this?
I tried page.findcontrol("controlname") and it does not work. Any ideas?
I
get a NullReference Error when I do this, because I guess the control
does
not exist on the page.
Thanks to everyone,
Chris