Gridview EditItemTemplate DropDownList Get SelectedValue
问题 In my Gridview I have the following template field: <asp:TemplateField HeaderText="Dept Code" SortExpression="DeptCode"> <ItemTemplate> <%# Eval("DeptCode") %> </ItemTemplate> <EditItemTemplate> <asp:DropDownList ID="ddlDeptCode" runat="server" SelectedValue='<%# Eval("DeptCode") %>' DataSource='<%# GetAllDepartments() %>' DataTextField="DeptCode" DataValueField="DeptCode" /> </EditItemTemplate> </asp:TemplateField> This works great when I click Edit on a row it populates the DropDownList