Hi,
Well, as I said you need to fill your DropDownList sooner. You must use RowCreated event handler instead of RowDataBound(as it fires sooner) so it is very important to know Page LifeCycle and event raise orders. Here is the new code:
Protected Sub RowCreated(ByVal sender As Object, ByVal e As GridViewRowEventArgs)
If e.Row.RowType = DataControlRowType.DataRow AndAlso GridView1.EditIndex = e.Row.RowIndex Then
Dim GV As DropDownList = e.Row.FindControl("DropDownlist1")
connstr = "server=localhost;User Id=xxxx;password=xxx;Persist Security Info=True;database=xxx"
strSQL = "select * from pdfmap"
conn = New MySqlConnection(connstr)
cmd = New MySqlCommand(strSQL, conn)
conn.Open()
reader = cmd.ExecuteReader
GV.DataSource = reader
GV.DataTextField = "NAME"
GV.DataValueField = "BASIC_ICONURL"
GV.DataBind()
End If
End Sub
I mean, just replace RowDataBound with RowCreated. It will probably work as it is the main problem.
I suggest you to examine different event handlers of the GridView. It can help you realize their fire orders.
Feel free to tell me if it does not work,
Cheers