• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1463
  • Last Modified:

How to refresh another frame in code-behind aspx web?

Hi, I have a frame-based web and would like to refresh another frame when the user submits new data via asp:textbox object. However, the frame should not be refreshed when the user changes the state of another objects in the same frame.

Currently, as seen from the code, the refresh is performed every time the user interacts with the asp:dropdownlist object. I want the refresh to occur only when the user changes the text in the asp:textbox object.

<HEAD>
<script language=JavaScript>
    top.mainframe.document.location.href = "BasicInfo/basicInfo.aspx"
</script>
</HEAD>
<body bgColor="black">
 <form id="Form1" method="post" runat="server">
    <asp:dropdownlist id="ddlPortfolios" style="Z-INDEX: 103; LEFT: 174px; POSITION: absolute; TOP: 49px" runat="server" Height="30px" Width="313px" AutoPostBack="True" onselectedindexchanged="ddlPortfolios_SelectedIndexChanged">
</asp:dropdownlist>
    <asp:textbox id="txtCustomerID" style="Z-INDEX: 104; LEFT: 10px; POSITION: absolute; TOP: 49px"
    		runat="server" Height="20px" Width="87px" OnTextChanged="txtCustomerID_TextChanged"></asp:textbox>
</form>
</body>

Open in new window

0
arni_richard
Asked:
arni_richard
1 Solution
 
gregoryyoungCommented:
well your java script is set to run no matter what (which explains why it is running every time).

An easy way to get this behavior would be to remove that javascript from the page and in your postback use http://msdn2.microsoft.com/en-us/library/system.web.ui.page.registerstartupscript(VS.71).aspx RegisterStartupScript to write out that javascript to refresh the frame.


Cheers,

Greg
0
 
arni_richardAuthor Commented:
It worked.

All I did was to remove the javascript and put the following code in the event handler for the asp:textbox
String scriptString = "<script language=JavaScript> top.mainframe.document.location.href = \"BasicInfo/basicInfo.aspx\" </script>";
 
            if (!this.IsStartupScriptRegistered("Startup"))
                this.RegisterStartupScript("Startup", scriptString);

Open in new window

0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now