can't find controls in datalist

Discussion in 'ASP .Net' started by bill yeager, Feb 23, 2004.

  1. bill yeager

    bill yeager Guest

    I have a radiobuttonlist inside a datalist. I also have a
    datagrid inside the datalist. The data and the controls
    are rendering just fine. However, I need to find these
    controls inside the datalist in order to programatically
    perform some logic.

    I have the following in my HTML which is inside the
    ItemTemplate of the datalist:


    <asp:RadioButtonList id="Radiobuttonlist" runat="server"
    OnSelectedIndexChanged="rblRadioButtonList_SelectedIndexCh
    anged"


    RepeatDirection="Horizontal" AutoPostBack="True">


    <asp:ListItem Value="1">Waive All
    Conditions</asp:ListItem>


    <asp:ListItem Value="0">Don't Waive Any
    Conditions</asp:ListItem>


    </asp:RadioButtonList>




    I have an event set up which comes into the following
    code-behind handler with the debugger after I click one
    of the radio buttons.


    Protected WithEvents RadioButtonListHdr As RadioButtonList

    ..

    ..

    ..

    Public Sub rblRadioButtonList_SelectedIndexChanged(ByVal
    sender As Object, ByVal e As System.EventArgs) Handles
    RadioButtonListHdr.SelectedIndexChanged



    'Capture the postback event from the
    radiobuttonlist

    Dim rblConditions As RadioButtonList = DirectCast
    (FindControl("Radiobuttonlist"), RadioButtonList)

    Dim dgChild As DataGrid = DirectCast(FindControl
    ("DataGrid3"), DataGrid)

    Dim chkCondition As CheckBox = DirectCast
    (FindControl("Condition3"), CheckBox)

    Dim lblLockNumber As Label = DirectCast
    (FindControl("LockNumber3"), Label)

    Dim lblConditionDetailID As Label = DirectCast
    (FindControl("ConditionDetailID3"), Label)

    Dim lblLoanID As Label = DirectCast(FindControl
    ("LoanID3"), Label)




    How come I cannot find any of the controls??? I'm very
    stumped with this if someone can PLEASE help........
    bill yeager, Feb 23, 2004
    #1
    1. Advertising

  2. bill yeager

    bill yeager Guest

    More simply put, how do I access child controls that
    reside in the ItemTemplate section of the datalist???

    There's GOT to be a way where I can access those controls
    outside of the ItemDataBound event of the datalist.....
    >-----Original Message-----
    >I have a radiobuttonlist inside a datalist. I also have

    a
    >datagrid inside the datalist. The data and the controls
    >are rendering just fine. However, I need to find these
    >controls inside the datalist in order to programatically
    >perform some logic.
    >
    >I have the following in my HTML which is inside the
    >ItemTemplate of the datalist:
    >
    >
    ><asp:RadioButtonList id="Radiobuttonlist" runat="server"
    >OnSelectedIndexChanged="rblRadioButtonList_SelectedIndexC

    h
    >anged"
    >
    >
    > RepeatDirection="Horizontal" AutoPostBack="True">
    >
    >
    > <asp:ListItem Value="1">Waive All
    >Conditions</asp:ListItem>
    >
    >
    > <asp:ListItem Value="0">Don't Waive Any
    >Conditions</asp:ListItem>
    >
    >
    > </asp:RadioButtonList>
    >
    >
    >
    >
    >I have an event set up which comes into the following
    >code-behind handler with the debugger after I click one
    >of the radio buttons.
    >
    >
    >Protected WithEvents RadioButtonListHdr As

    RadioButtonList
    >
    >..
    >
    >..
    >
    >..
    >
    >Public Sub rblRadioButtonList_SelectedIndexChanged(ByVal
    >sender As Object, ByVal e As System.EventArgs) Handles
    >RadioButtonListHdr.SelectedIndexChanged
    >
    >
    >
    > 'Capture the postback event from the
    >radiobuttonlist
    >
    > Dim rblConditions As RadioButtonList = DirectCast
    >(FindControl("Radiobuttonlist"), RadioButtonList)
    >
    > Dim dgChild As DataGrid = DirectCast(FindControl
    >("DataGrid3"), DataGrid)
    >
    > Dim chkCondition As CheckBox = DirectCast
    >(FindControl("Condition3"), CheckBox)
    >
    > Dim lblLockNumber As Label = DirectCast
    >(FindControl("LockNumber3"), Label)
    >
    > Dim lblConditionDetailID As Label = DirectCast
    >(FindControl("ConditionDetailID3"), Label)
    >
    > Dim lblLoanID As Label = DirectCast(FindControl
    >("LoanID3"), Label)
    >
    >
    >
    >
    >How come I cannot find any of the controls??? I'm very
    >stumped with this if someone can PLEASE help........
    >.
    >
    bill yeager, Feb 24, 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. Nevyn Twyll
    Replies:
    8
    Views:
    1,869
  2. ad
    Replies:
    2
    Views:
    856
  3. William Yeager

    cannot find some controls in a datalist

    William Yeager, Feb 24, 2004, in forum: ASP .Net Web Controls
    Replies:
    2
    Views:
    139
    William Yeager
    Feb 26, 2004
  4. Jun
    Replies:
    1
    Views:
    257
    Alvin Bruney [MVP]
    Mar 2, 2004
  5. Wybo Dekker
    Replies:
    1
    Views:
    353
    Yukihiro Matsumoto
    Nov 15, 2005
Loading...

Share This Page