Can a control trigger itself for AJAX.NET?

Posted on 2007-08-03
Last Modified: 2013-11-07
I have a TreeView control in AJAX.NET 2.0 / C#. What I'm trying to do is set a trigger on an UpdatePanel that comes from itself. Is this possible? Here's what I'm trying to do but gives a compile error saying it can't find the event name:

        <asp:UpdatePanel ID="TreeUpdatePanel1" runat="server" UpdateMode="Conditional">
        <asp:TreeView ID="TreeView1" runat="server"
                OnSelectedNodeChanged="TreeView1_SelectedNodeChanged" >
            <asp:AsyncPostBackTrigger ControlID="TreeView1" EventName="ExpandNode" />

The error I get is this:
Could not find an event named 'ExpandNode' on associated control 'TreeView1' for the trigger in UpdatePanel 'TreeUpdatePanel1'.

Can I trigger a control with an event from itself?
Question by:bemara57
    LVL 4

    Expert Comment

    by:Tommie Nathaniel Carter, Jr., MBA
    If the control has sub controls. The subs have events bound to them then I expect this would work.
    LVL 7

    Accepted Solution

    For the update panel, set ChildrenAsTriggers = True.  With that then every control in the update panel will cause the asynch postback without explicity setting it in the Triggers node.  The control's event will need to cause a postback of course for this to work.  If ExpandNode doesn't cause a postback normally then it won't cause the UpdatePanel to fire either.

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Free Trending Threat Insights Every Day

    Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

    ASP.Net to Oracle Connectivity Recently I had to develop an ASP.NET application connecting to an Oracle database.As I am doing it first time ,I had to solve several problems. This article will help to such developers  to develop an ASP.NET client…
    User art_snob ( encountered strange behavior of Android Web browser on his Mobile Web site. It took a while to find the true cause. It happens so, that the Android Web browser (at least up to OS ver. 2.…
    It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
    Hi everyone! This is Experts Exchange customer support.  This quick video will show you how to change your primary email address.  If you have any questions, then please Write a Comment below!

    759 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    11 Experts available now in Live!

    Get 1:1 Help Now