Wednesday, March 21, 2012

Need partial page update when IFrame is placed inside the updatepanel

How to achieve partial page update when an iFrame is placed inside the updatepanel. The page is getting posted completely. Any suggestions please tell me.

<ajax:UpdatePanelID="UpdatePanel1"runat="server">

<ContentTemplate>

<iframeid="Iframe1"src="Default5.aspx"runat="server"

scrolling="no"frameborder="0"

style="width: 466px;height:100px">

</iframe>

<hr/>

<asp:LabelID="Label2"runat="server"Text="Label"></asp:Label>

<hr/>

</ContentTemplate>

<Triggers>

<ajax:AsyncPostBackTriggerControlID="Button1"EventName="Click"/>

</Triggers>

</ajax:UpdatePanel>

Hi,devingtonb

The page isn'tgetting posted completely as you said, it just refreshed theDefault5.aspx in the "Iframe1"!

Look at the following codes:

<%@. Page Language="VB" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<script runat="server">

Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs)
Label2.Text = DateTime.Now.ToString()
Label1.Text = DateTime.Now.ToString()
End Sub
</script>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>Untitled Page</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager>
</div>
<asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Conditional">
<ContentTemplate>
<iframe id="Iframe1" src="http://pics.10026.com/?src=Default5.aspx" runat="server" scrolling="no" frameborder="0"
style="width: 466px; height: 100px"></iframe>
<hr />
<asp:Label ID="Label2" runat="server" Text="Label"></asp:Label>
<hr />
</ContentTemplate>
<Triggers>
<asp:AsyncPostBackTrigger ControlID="Button1" EventName="Click" />
</Triggers>
</asp:UpdatePanel>
<asp:Button ID="Button1" runat="server" Text="Button" OnClick="Button1_Click" />
<asp:Label ID="Label1" runat="server" Text="Label"></asp:Label>
</form>
</body>
</html>

After the clicked the Button,The Label2.Text changed,but the Label1.Text didn't changed, so we can see that the page isn'tgetting posted completely!

Hope this helps!


Hi Jin,

But here we get the feel of the page getting posted completely. If it is a busy page like a database driven page, the page gets completely posted.

Is there any option or attributes to be set in the updatepanel to get it. In ATLAS, this does not happen this way, the page is refreshed on that IFRAME area only.

Regards,

Devington

No comments:

Post a Comment