- For individual users
- Instant access to solutions
- Ask your tech questions
- Start your 30-day Free Trial
Main Topics
Browse All TopicsHi,
i have following javascript function in my c# code
private void btnLockBottom_Click(object
{
string period = string.Empty;
int Id = int.Parse(Request.Params["
int Year = 0, Qtr = 0;
period = ddlPeriod.SelectedValue;
Year = int.Parse (period.Substring (0,4));
Qtr = int.Parse (period.Substring (4,1));
}
string PopUpScript = "<script language='javascript'>" +
string.Format ("window.open('Lock.aspx?I
Page.RegisterStartupScript
}
now when ever this button is clicked the window is poped up and the main window where this button resides is refreshing and loosing its content can anyone say what do i have to add so tht when popup window is called the main window does not refreshes i guess ihave to add siomething in PopUpScript
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
Business Accounts
Answer for Membership
by: jnhorstPosted on 2006-10-20 at 14:16:01ID: 17777364
First, since you are clicking a server-control button, there is no way to avoid the "refresh" of the page. If you want to do this with posting back, you'll have to use a regular client side button (<input type="button" ... />) and then code the onclick event to call a JavaScript function in the aspx page to show the new window.
But if you need to stay with the server control, I think you can, but your problem is probably in your page_load event. You should only get the data for the ddl and call DataBind() when the page is not a postback, like this:
// check postback.
if (!this.IsPostBack)
{
// code here to load your data for the ddl.
ddlPeriod.DataBind();
}
This will prevent the data in the ddl from being refreshed and reset to the first item when the server button is clicked.
John