Combo Box in a datagrid

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
 
M

[MSFT]

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.)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,266
Messages
2,571,082
Members
48,773
Latest member
Kaybee

Latest Threads

Top