Combo Box in a datagrid

Discussion in 'ASP .Net' started by Dave, Jun 19, 2004.

  1. Dave

    Dave Guest

    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
     
    Dave, Jun 19, 2004
    #1
    1. Advertising

  2. Dave

    [MSFT] Guest

    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.)
     
    [MSFT], Jun 21, 2004
    #2
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. =?Utf-8?B?QW5nZWw=?=

    COMBO BOX INSTEAD OF DROP DOWN BOX

    =?Utf-8?B?QW5nZWw=?=, Jun 29, 2004, in forum: ASP .Net
    Replies:
    3
    Views:
    647
    Ken Cox [Microsoft MVP]
    Jun 29, 2004
  2. Adrian
    Replies:
    1
    Views:
    248
    Bullschmidt
    Feb 18, 2004
  3. dthmtlgod

    Fill Combo Box based on another Combo Box

    dthmtlgod, Nov 16, 2005, in forum: ASP General
    Replies:
    1
    Views:
    622
    Bob Barrows [MVP]
    Nov 16, 2005
  4. Mike

    Combo Box and text box

    Mike, Sep 24, 2003, in forum: Javascript
    Replies:
    2
    Views:
    178
  5. SM
    Replies:
    2
    Views:
    401
Loading...

Share This Page