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
Here is a simplified version of my code:
<%
@.PageLanguage="VB"MasterPageFile="~/Master.master"AutoEventWireup="false"CodeFile="test.aspx.vb"Inherits="test"title="Untitled Page" %><
asp:ContentID="ctSearch"ContentPlaceHolderID="cphSearch"Runat="Server"><asp:ButtonID="btnSearch"runat="server"Text="Search"/></
asp:Content><
asp:ContentID="ctBody"ContentPlaceHolderID="cphBody"Runat="Server"><asp:UpdatePanelid="upMain"runat="server"><contenttemplate><asp:GridViewid="grdGrid"runat="server"></asp:GridView></contenttemplate><triggers><asp:AsyncPostBackTriggerControlID="btnSearch"EventName="Click"></asp:AsyncPostBackTrigger></triggers></asp:UpdatePanel></
asp:Content>
Thanks,
Jaime
This is from my another post:
I have solved my problem by doing the following..
Iwrapped my 2 content areas in the master page in a update panel.Basically I put the content panes inside an update panel in the masterpage. 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
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
Can you post your source here. I shall look into it, it works fine for me.
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 aroundboth 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>
No comments:
Post a Comment