Trigger Update Panel from button on different ContentPanel

Last post 03-14-2007 11:23 PM by seanpkelly. 5 replies.

Sort Posts:

  • Trigger Update Panel from button on different ContentPanel

    02-06-2007, 2:27 PM
    • Loading...
    • jaimemesias
    • Joined on 02-06-2007, 5:59 PM
    • Kansas City
    • Posts 3

    I have a master page with two contet panels: cntSearch and cntBody.  The cntSearch panel has a search form and a button (btnSubmit), the cntBody panel, among other things, has an Update Panel which contains a  gridview (grdMain).  I am trying to set up a trigger between the submit button in the cntSearch panel and the gridview in the cntBody.  Visual Studio 2005 IDE allows me to pick btnSubmit and its Click() event from the list of possible controls when I go and add a Trigger to the Update Panel.  However, when I try to load the page I get an error indicating that "A control with ID "btnSubmit" could not be found for the trigger in UpdatePanel...."

    When I move the button from the cntSearch Content Panel inside the cntBody Content Panel, the page loads fine.  Is there a special way I need to reference the button's ID in the Trigger section of the Update Panel so that it can find it?

     Thanks,

     Jaime

  • Re: Trigger Update Panel from button on different ContentPanel

    02-06-2007, 6:00 PM
    • Loading...
    • jaimemesias
    • Joined on 02-06-2007, 5:59 PM
    • Kansas City
    • Posts 3

    Here is a simplified version of my code:

    <%

    @ Page Language="VB" MasterPageFile="~/Master.master" AutoEventWireup="false" CodeFile="test.aspx.vb" Inherits="test" title="Untitled Page" %>

    <

    asp:Content ID="ctSearch" ContentPlaceHolderID="cphSearch" Runat="Server">

    <asp:Button ID="btnSearch" runat="server" Text="Search" />

    </

    asp:Content>

    <

    asp:Content ID="ctBody" ContentPlaceHolderID="cphBody" Runat="Server">

    <asp:UpdatePanel id="upMain" runat="server">

    <contenttemplate>

    <asp:GridView id="grdGrid" runat="server"></asp:GridView>

    </contenttemplate>

    <triggers>

    <asp:AsyncPostBackTrigger ControlID="btnSearch" EventName="Click"></asp:AsyncPostBackTrigger>

    </triggers>

    </asp:UpdatePanel>

    </

    asp:Content>

     

    Thanks,

     Jaime

  • Re: Trigger Update Panel from button on different ContentPanel

    02-08-2007, 1:23 PM
    • Loading...
    • marathi
    • Joined on 02-09-2005, 2:08 PM
    • Posts 34

    This is from my another post:

    I have solved my problem by doing the following..

    I wrapped my 2 content areas in the master page in a update panel. Basically I put the content panes inside an update panel in the master page. Now on my other page, if I click on a button in one content area, both the contents get updated without the page being refreshed.

     

    Thanks 


     

  • Re: Trigger Update Panel from button on different ContentPanel

    02-13-2007, 4:17 PM
    • Loading...
    • jaimemesias
    • Joined on 02-06-2007, 5:59 PM
    • Kansas City
    • Posts 3

    Thanks for the reply marathi.  I tried your suggesting and it did not work, I am still getting the error indicating that the submit button can not be found.

     

    Jaime

  • Re: Trigger Update Panel from button on different ContentPanel

    02-14-2007, 9:21 AM
    • Loading...
    • marathi
    • Joined on 02-09-2005, 2:08 PM
    • Posts 34

    Can you post your source here. I shall look into it, it works fine for me.

     

  • Re: Trigger Update Panel from button on different ContentPanel

    03-14-2007, 11:23 PM
    • Loading...
    • seanpkelly
    • Joined on 10-27-2006, 2:03 PM
    • Posts 3

    Thanks to marathi for putting me on the right track since no final post was here I thought I would add my derived solution.  Basically if you place the UpdatePanel control in the master page and around both content panels you can still place the Trigger in the child page where the triggering control is defined.  My own use was to have a calendar in the first content section change the content in the second content frame (a custom control) and it works great.

    In your master page: 
    <asp:UpdatePanel ID="UpdatePanel1" runat="server"> 
    	<ContentTemplate> 
    		<asp:ContentPlaceHolder ID="cntSearch" runat="server"></asp:ContentPlaceHolder>
    		<asp:ContentPlaceHolder ID="cntBody" runat="server"></asp:ContentPlaceHolder> 
    	</ContentTemplate>
    </asp:UpdatePanel>
     In your child page:
      
    <asp:Content ID="cntSearchContent" ContentPlaceHolderID="cntSearch" runat="server">
    	<asp:TextBox runat="server" ID="SearchText"></asp:TextBox> <asp:Button ID="SearchButton" runat="server" Text="Search" />
    </asp:Content>
    
    <asp:Content ID="cntBodyContent" ContentPlaceHolderID="cntBody" runat="server"> 
    	<asp:GridView ID="GridView1" runat="server"></asp:GridView>
    	<Triggers>
    		<asp:AsyncPostBackTrigger ControlID="SearchButton" EventName="Click" />
    	</Triggers> 
    </asp:Content>
     
     
Page 1 of 1 (6 items)
Microsoft Communities
Page view counter