Gridview in C # Editable Column with Dropdownlist

I am designing a gridview in C # where in a column, when pressing edit I load a dropdownlist that allows me to choose values to change, could you please suggest me, how to do it, I had the following idea:

<asp:TemplateField HeaderText="Grado Asignado">
    <ItemTemplate>
        <asp:Label Text='<%# Eval("gradoAsig") %>' runat="server" ID="lblgradoAsig" />
        <asp:DropDownList ID="ddlgradoAsigItem" Font-Size="X-Small" Width="100px" runat="server"></asp:DropDownList>                        
    </ItemTemplate>
    <EditItemTemplate>
        <asp:TextBox ID="txtgradoAsig" MaxLength="10" Font-Size="X-Small" Width="80px"  Text='<%# Eval("gradoAsig") %>' runat="server" />Cambiar por
        <asp:DropDownList ID="ddlgradoAsigEdit" Font-Size="X-Small" Width="80px" runat="server"></asp:DropDownList> 
    </EditItemTemplate>
    <FooterTemplate>
        <asp:TextBox ID="txtgradoAsigFooter" runat="server" MaxLength="10" Width="200px" />
    </FooterTemplate>
</asp:TemplateField>
4
Elena Rostova

Elena Rostova

Lead Health, Wellness & Medical Journalist

Elena Rostova holds a Master's degree in Public Health Journalism. She covers groundbreaking medical research, holistic wellness trends, mental health awareness, and nutritional science.

Share this article