AJAX TOOLKIT : Accordion (can't access controls)

Discussion in 'ASP .Net' started by googlegroup@desiboy.com, Jan 26, 2007.

  1. Guest

    I have master pages , with MyAccordion and 2 panes.
    I can veiw the controls within MyAccordion on pageLoad


    Output of controls:

    MyAccordion_AccordionExtender
    AccordionPane1
    AccordionPane2

    However, with the code below, it fails

    Try
    Dim frm As Control =
    Page.Master.FindControl("Main").FindControl("form1").FindControl("MyAccordion")
    Dim acc As Control
    acc = DirectCast(frm.FindControl("AccordionPane1"),
    AjaxControlToolkit.AccordionPane)

    Dim str As String = ""
    Dim ctl As Control
    For Each ctl In acc.Controls

    str = str & ctl.ID.ToString & "<br>"

    Next
    Return str
    Catch ex As Exception
    Return ex.Message
    End Try


    Output : Object reference not set to an instance of an object.


    How do you gain access to the controls (in my case radiobuttons) that
    belong within the two panes in MyAccordion on PageLoad ?
    , Jan 26, 2007
    #1
    1. Advertising

  2. > Dim frm As Control =
    > Page.Master.FindControl("Main").FindControl("form1").FindControl("MyAccordion")


    > Output : Object reference not set to an instance of an object.


    Have you checked out which line is causing this exception?

    IMHO, it should have been Page.FindControl("form1")
    btw, what is "Main" control?


    --
    Happy Hacking,
    Gaurav Vaish | www.mastergaurav.com
    www.edujini-labs.com
    http://eduzine.edujini-labs.com
    -----------------------------------------
    MasterGaurav \(www.edujini-labs.com\), Jan 30, 2007
    #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. Replies:
    1
    Views:
    2,341
    Matteo Migliore
    Jul 20, 2007
  2. Andy B
    Replies:
    0
    Views:
    567
    Andy B
    Nov 28, 2007
  3. Tomasz J
    Replies:
    9
    Views:
    1,031
    Jason Mah
    Dec 30, 2008
  4. Scott M.
    Replies:
    0
    Views:
    395
    Scott M.
    Oct 29, 2009
  5. Gregory A. Beamer

    Re: Accordion and Gridview in AJAX Control Toolkit

    Gregory A. Beamer, Oct 29, 2009, in forum: ASP .Net
    Replies:
    0
    Views:
    1,053
    Gregory A. Beamer
    Oct 29, 2009
Loading...

Share This Page