I want to set ComboBox in ASP.NET GridView, but I don't know how.

Asked 2 years ago, Updated 2 years ago, 299 views

I can set DropDownList in GridView, but I want to set ComboBox.
The reason is that I want to select multiple candidates + enter new ones.
However, although there is ComboBox in AjazToolKit, I cannot set it up.
Could someone please teach me?

running environment:
NetFramework 4.0
Windows 10 VisualStudio 2010

<asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager>

<asp: GridView ID="GridView 1" runat="server" Height="195px" Width="362px">
    <Columns>
        <asp:TemplateField>
            <EditItemTemplate>
                <asp:DropDownListID="DropDownList2" runat="server">
                </asp: DropDownList>
            </EditItemTemplate>
            <ItemTemplate>
                <asp:Label ID="Label1" runat="server"></asp:Label>
                <asp:DropDownListID="DropDownList1" runat="server">
                </asp: DropDownList>
            </ItemTemplate>
        </asp: TemplateField >
    </Columns>
</asp: GridView>

** Dragging the ComboBox of AjaxToolKit to the item template does not reflect.
Therefore, ComboBox cannot be added to GridView at this time.

item

asp.net

2022-09-30 21:56

1 Answers

However, although there is ComboBox in AjazToolKit, I cannot set it up.

What does "cannot be configured" mean? If you simply want to display it, you should place ComboBox instead of DropDownList.as follows:

<EditItemTemplate>
  <ajaxToolkit: ComboBox ID="ComboBox1" runat="server">
    <asp:ListItem Text="AAA" Value="1"></asp:ListItem>
    <asp:ListItem Text="BBB" Value="2"></asp:ListItem>
    <asp:ListItem Text="CCC" Value="3"></asp:ListItem>
  </ajaxToolkit:ComboBox>
</EditItemTemplate>

The result is:

Enter a description of the image here


2022-09-30 21:56

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.