DataGrid Pulldowns- how to access

Discussion in 'ASP .Net Datagrid Control' started by Ken Webster, Sep 22, 2005.

  1. Ken Webster

    Ken Webster Guest

    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, Sep 22, 2005
    #1
    1. Advertising

  2. 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:
    http://aspnet.4guysfromrolla.com/articles/080702-1.aspx

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

    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]

    http://www.4GuysFromRolla.com/ScottMitchell
    Scott Mitchell [MVP], Sep 23, 2005
    #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. Slinky
    Replies:
    7
    Views:
    408
    Doug Miller
    Aug 8, 2009
  2. J. Muenchbourg
    Replies:
    1
    Views:
    151
    Dr John Stockton
    Jul 29, 2003
  3. Hans van Dijk

    3 conditional pulldowns

    Hans van Dijk, Feb 6, 2004, in forum: Javascript
    Replies:
    1
    Views:
    131
    Bill Rossi
    Feb 6, 2004
  4. Me
    Replies:
    2
    Views:
    100
  5. Shawn Gordhamer

    Need Pulldowns That Filter What you Type

    Shawn Gordhamer, Sep 26, 2006, in forum: Javascript
    Replies:
    0
    Views:
    85
    Shawn Gordhamer
    Sep 26, 2006
Loading...

Share This Page