Saturday, March 24, 2012

Invoking postback for an update panel in a parent document

The default page for my website contains a div with links to user data that is only visible when a user is logged into my site. The login control lives in an IFrame within the default page (see sample code below).

Now, how can I get the udpate panel on the default page to recognize an event or a button click inside of the login control? I'm not looking for a tutorial on getting the login control to work, but rather any link button inside of the IFrame's update panel forcing the default page's update panel to post back. Both pages have a script manager.

chopped down version of existing code:

dafault page:

1<asp:update panel id="upUserPrefs" runat="server" updatemode="conditional">2 <contenttemplate>3 <div id="userPrefs" runat="server"><a href="prefs.aspx">preferences</a></div>4 </contenttemplate>5</asp:update panel>

IFrame source page:

1 <asp:UpdatePanel ID="updateSignon" runat="server" UpdateMode="conditional">2 <ContentTemplate>3 <asp:Table ID="tblLoginCtrl" runat="server" visible="false" Width="100%" HorizontalAlign="Left" CellPadding="0" CellSpacing="0">4 <asp:TableRow>5 <asp:TableCell ID="tcLoginCtrl">6 <uc1:LoginControl ID="LoginControl" Enable runat=server LoginStyle=Login_Home />7 </asp:TableCell>8 </asp:TableRow>9 </asp:Table>10 </ContentTemplate>11 </asp:UpdatePanel>
Any help would be greatly appreciated.

</p><p> (this.Parent.Parent as UpdatePanel).Update();</p><p>

is what I use.....however i have other problems...LOL. but that should fix yours.


Hi,

I think you can add a invisible button in the default page, set it as a trigger for the update panel.

Then add a javascript function in the contained page, in which invoke the click event of the button in the container.

Please feel free to let me know if there is any problem.


I tried that before, but when I have 2 instances of the same control on my page, it fires events for both of them. Or did I do something wrong?? Should this be happening? Have you ever heard of this??


In my opinion, it's normal that two control of the same type would behavior the same.

No comments:

Post a Comment