DataGrid Pulldowns- how to access

Ask a Question related to ASP.NET Data Grid Control, Design and Development.

  1. #1

    Default DataGrid Pulldowns- how to access

    Given a pulldown template like:

    <asp:TemplateColumn HeaderText="PO Line">
    <ItemTemplate>
    <asp:Label id="TX_POLine" runat="server" BorderColor="#E0E0E0"
    BackColor="White" BorderStyle="Solid"></asp:Label>
    </ItemTemplate>
    <EditItemTemplate>
    <asp:DropDownList id="CB_POLine" runat="server"
    Width="75px"></asp:DropDownList>
    </EditItemTemplate>
    </asp:TemplateColumn>

    How/where can I populate the pulldown in code?

    I've tried everything I can think of to find that pulldown, but with no
    luck. My latest attempt was:
    For liRow = 0 To DG_List.Items.Count - 1
    pd = CType(DG_List.Items(lirow).FindControl("CB_POLine" ), DropDownList)
    If Not pd Is Nothing Then
    ' --- should break here if the pulldown is found
    End If
    Next

    Thanks


    Ken Webster Guest

  2. Similar Questions and Discussions

    1. Access the buttons in the datagrid within another datagrid
      I have a datagrid whose, data is bound from a database. Inside the datagrid there is a template column that holds another datagrid. How to get a...
    2. CF pulldowns
      When I display a field from a database query in a form using CFForm and include a pulldown list on that field the pulldown options overwrite the...
    3. how do i access a dropdownlists selected value in a datagrid edititemtemplate column from the selectedindexchanged event of another dropdownlist in a datagrid edititemtemplate column
      i am trying to trap the value of one dropdownlist (in a datagrid edititemtemplate column) at the time its selectedindexchanged event fires and use...
    4. Linked Database Pulldowns
      Hi Everyone, I have a problem, and it's causing me to tear my hair out... On allhvacinfo.com, they have pulldowns which are linked together......
    5. Access to Rows in a datagrid
      I am working on a page to allow editing of products in out database. I'd like to bind a datareader to the table. And on submit generate an update...
  3. #2

    Default Re: DataGrid Pulldowns- how to access

    Ken, it matters when you're doing this. If you put a breakpoint in your
    code, what's the value of DG_List.Items.Count?

    Here's an article that shows how to display a DDL in an editable DG:
    [url]http://aspnet.4guysfromrolla.com/articles/080702-1.aspx[/url]

    Also, you might want to consider taking a look at Andy Smith's free
    BoundLookupColumn DataGridColumn control:
    [url]http://metabuilders.com/Tools/BoundLookupColumn.aspx[/url]

    hth



    Ken Webster wrote:
    > Given a pulldown template like:
    >
    > <asp:TemplateColumn HeaderText="PO Line">
    > <ItemTemplate>
    > <asp:Label id="TX_POLine" runat="server" BorderColor="#E0E0E0"
    > BackColor="White" BorderStyle="Solid"></asp:Label>
    > </ItemTemplate>
    > <EditItemTemplate>
    > <asp:DropDownList id="CB_POLine" runat="server"
    > Width="75px"></asp:DropDownList>
    > </EditItemTemplate>
    > </asp:TemplateColumn>
    >
    > How/where can I populate the pulldown in code?
    >
    > I've tried everything I can think of to find that pulldown, but with no
    > luck. My latest attempt was:
    > For liRow = 0 To DG_List.Items.Count - 1
    > pd = CType(DG_List.Items(lirow).FindControl("CB_POLine" ), DropDownList)
    > If Not pd Is Nothing Then
    > ' --- should break here if the pulldown is found
    > End If
    > Next
    >
    > Thanks
    >
    >

    --

    Scott Mitchell [ASP.NET MVP]
    [email]mitchell@4GuysFromRolla.com[/email]
    [url]http://www.4GuysFromRolla.com/ScottMitchell[/url]
    Scott Mitchell [MVP] Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139