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.

<script language=JavaScript>
    top.mainframe.document.location.href = "BasicInfo/basicInfo.aspx"
<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:textbox id="txtCustomerID" style="Z-INDEX: 104; LEFT: 10px; POSITION: absolute; TOP: 49px"
    		runat="server" Height="20px" Width="87px" OnTextChanged="txtCustomerID_TextChanged"></asp:textbox>

Open in new window

Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

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 RegisterStartupScript to write out that javascript to refresh the frame.



Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
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

It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Editors IDEs

From novice to tech pro — start learning today.