Combo Box in a datagrid

  • Thread starter Thread starter Dave
  • Start date Start date
D

Dave

I have a combo box in a asp.net datagrid -

only problem is you have to click once to see it - and then click the arrow
to see your choices

I would like combo box to be visible - with the choices selectable when the
users goes to a cell with a combo box.

Anyone have any ideas.

Thanks

Dave
 
Hi Dave,

You may add the combo box in a TemplateColumn for example:

<asp:DataGrid id="DemoGrid" runat="server" DataKeyField="CustomerID">
<Columns>
<asp:TemplateColumn HeaderText="Customer">
<ItemTemplate>
<asp:DropDownList ID="MyCombo" Runat="server" />
</ItemTemplate>
</asp:TemplateColumn>
</Columns>
</asp:DataGrid>

To access the dropdownlist control in code behind, you can use following
code;

Dim DemoGridItem As DataGridItem
For Each DemoGridItem In DemoGrid.Items

Dim mycombo As DropDownList =
CType(DemoGridItem.Cells(0).Controls(1), DropDownList)
...
Next

Hope this help,

Luke
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)
 
Back
Top