Getting the selected value of a dropdown in the edititemtemplate of a gridview that is tied to a datasource

Ok basically I've tried the solutions that I've seen on here and none of them have worked for me.  I have a dropdown list in a gridview in an edititemtemplate.  I need for the selected value to display in the series dropdownbox when the edit link is clicked.  I tried selectedvalue but only got the selectedvalue not in the list error.  Please advise.  Here is my code
<%-- PROGRAM --%>
        <asp:templatefield HeaderText="Program" ItemStyle-Width="60%">
            <ItemTemplate><asp:label id="lblProgramTitle" runat="server" text='<%# Bind("ProgramTitle") %>' /></ItemTemplate>
                        <td><asp:DropDownList ID="ddlSeries" runat="server" DataTextField="SeriesName" DataValueField="SeriesID" OnSelectedIndexChanged="GetPrograms" AutoPostBack="true" /></td>
                        <td><asp:DropDownList ID="ddlPrograms" DataTextField="ProgramTitle" DataValueField="ProgramID" runat="server" /></td>
Code Behind:
Protected Sub grdPlaylist_RowDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles grdPlaylist.RowDataBound
            Dim objData As New AmazingFacts.Modules.MediaManager.MediaManagerController
            Dim recDataList As List(Of AmazingFacts.Modules.MediaManager.MediaManagerInfo)
            Dim ddlSeries As DropDownList
            If e.Row.RowType = DataControlRowType.DataRow Or e.Row.RowType = DataControlRowType.Footer Or e.Row.RowType = DataControlRowType.EmptyDataRow Then
                ddlSeries = CType(e.Row.FindControl("ddlSeries"), DropDownList)
                If Not (ddlSeries) Is Nothing Then
                    recDataList = objData.GetSeriesProfiles(ModuleId)
                    ddlSeries.DataSource = recDataList
                    ddlSeries.Items.Insert(0, New ListItem("--- Please select one ---", ""))
                End If
            End If
        End Sub
Protected Sub grdPlaylist_RowEditing(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewEditEventArgs) Handles grdPlaylist.RowEditing
            grdPlaylist.EditIndex = e.NewEditIndex
        End Sub
Would the code to accomplish that I'm trying to do go in the rowdatabound method or rowediting?

Open in new window

DanNetwork EngineerAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

DanNetwork EngineerAuthor Commented:

I had a similar problem with a page of mine.   The code that says:

ddlSeries = CType(e.Row.FindControl("ddlSeries"), DropDownList)

Needs to be modified slightly.  

ddlSeries = CType(CType(gv, GridView).Rows(i).FindControl("ddlSeries"), DropDownList)

In this code gv is the gridview that the dropdownlist appears in.  That worked for me.  Hope that helps.
DanNetwork EngineerAuthor Commented:
Well this code

ddlSeries = CType(e.Row.FindControl("ddlSeries"), DropDownList)

is actually working fine.  I'm not having problems with that.  I was wondering what code to add and where to get the selected value for the dropdown when its in editmode ... should the code be in the rowdatabound or rowediting method?  I've tried both but have not been successful.  
DanNetwork EngineerAuthor Commented:

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.