I am very new to this..

I have used a repeater control and it fetches about 100 records from the database.
Inside the repeater control, I am having 4 columns and in one column, I hav used one dropdown list as

<asp:DropDownList ID="st" Runat="server"  AutoPostBack=true  OnSelectedIndexChanged="go_change" CssClass=rtd Runat=server>
	<asp:ListItem text="--Select--" Value='NULL' Selected="True" />
	<asp:ListItem text="Accepted" Value="Accepted" />
	<asp:ListItem text="Rejected" Value="Rejected" />

In the gochange method
I am calling the window.open function.

My problem is
If I am clicking the 50th row's dropdownlist box, it is opening the new window and it always goes back to the First row(refreshing that page). How to avoid this? Please help me to solve this... Because each time scrolling down is a great pain to the user.

Thanx in Advance..

Recommended Answers

All 4 Replies


you need to set the MaintainScrollPositionOnPostBack in the aspx page <%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" [B]MaintainScrollPositionOnPostback="true"[/B] %> That is in vs 2005. in vs2003 i think is SmartNavigation="true"


Thank you..

I have set the smartnavigation= true. But,while clicking the dropdownlist, i am opening a new window to execute another file and that popup is going back.
how to set the focus on the child window instead of parent one

This code going into the dropdown event change, i think you are using 2003, im sorry i cant test this code in that version but in 2005 it work, hope that work for you.

string strJS = "";
        strJS = "newwindow2 = window.open('URL','MyWindow','menubar=no,toolbar=no,status=no,scrollbars=no,resizable=yes,width=300,height=200');"; 
        strJS += "newwindow2.focus();";
        ScriptManager.RegisterStartupScript(this, GetType(), "alert", strJS, true);


I tried it.. But it is not working and it affect other javascript functions also. I found an alternate solution and it solved my problem.

function SaveScrollXY()
document.getElementById("ScrollX").value = document.body.scrollLeft;
document.getElementById("ScrollY").value = document.body.scrollTop;

function ResetScrollPosition()

<body  bgColor=whitesmoke  MS_POSITIONING="GridLayout"  onscroll=SaveScrollXY() onload=ResetScrollPosition()>
<form id=Form1 runat="server">
<input type=hidden id=ScrollX name=ScrollX value=0 runat=server>
		<input type=hidden id=ScrollY name=ScrollY value=0 runat=server>



Thank you very much/

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.