Page goes back to top everytime it's posted back
-
I have a page containing a datagrid with the first column selectable. If a record is selected, information for that record will be shown on the right. The page is quite long due the large amount of information (thus, long list of data in the datagrid). The problem is when i select a record at the bottom (or lower than a page), the page brings me back to the top of the page. Actually, this is not really a problem. It's just annoying/not working as i want it to. So i wonder if there's a way to set a focus to a specific control e.g. the clicked record or any better way to make it stay where i want. KiT
-
I have a page containing a datagrid with the first column selectable. If a record is selected, information for that record will be shown on the right. The page is quite long due the large amount of information (thus, long list of data in the datagrid). The problem is when i select a record at the bottom (or lower than a page), the page brings me back to the top of the page. Actually, this is not really a problem. It's just annoying/not working as i want it to. So i wonder if there's a way to set a focus to a specific control e.g. the clicked record or any better way to make it stay where i want. KiT
I think, setting Smart Navigation property of page to "True" will handle your problem. --junior coder--
-
I have a page containing a datagrid with the first column selectable. If a record is selected, information for that record will be shown on the right. The page is quite long due the large amount of information (thus, long list of data in the datagrid). The problem is when i select a record at the bottom (or lower than a page), the page brings me back to the top of the page. Actually, this is not really a problem. It's just annoying/not working as i want it to. So i wonder if there's a way to set a focus to a specific control e.g. the clicked record or any better way to make it stay where i want. KiT
check this page out: http://aspnet.4guysfromrolla.com/articles/111704-1.2.aspx edit:forgot link --------------------------- 127.0.0.1 - Sweet 127.0.0.1
-
I have a page containing a datagrid with the first column selectable. If a record is selected, information for that record will be shown on the right. The page is quite long due the large amount of information (thus, long list of data in the datagrid). The problem is when i select a record at the bottom (or lower than a page), the page brings me back to the top of the page. Actually, this is not really a problem. It's just annoying/not working as i want it to. So i wonder if there's a way to set a focus to a specific control e.g. the clicked record or any better way to make it stay where i want. KiT
well using smart navigation only works in IE a better way is to use the onscroll event and write the scroll y pos to a hiddenfield and let the body onload event call a method that sets the value of scroll y pos to the hiddenfield value, this works in IE and Mozilla browsers however not in Opera since they have removed the onscroll event Wyx :cool:
-
I have a page containing a datagrid with the first column selectable. If a record is selected, information for that record will be shown on the right. The page is quite long due the large amount of information (thus, long list of data in the datagrid). The problem is when i select a record at the bottom (or lower than a page), the page brings me back to the top of the page. Actually, this is not really a problem. It's just annoying/not working as i want it to. So i wonder if there's a way to set a focus to a specific control e.g. the clicked record or any better way to make it stay where i want. KiT
Hi use this javascript for setting the page fixed on page postback 1)place this below script in betwwen your page head tags
function ScrollIt(){ window.scrollTo(document.Form1.PageX.value, document.Form1.PageY.value); } function setcoords(){ var myPageX; var myPageY; if (document.all){ myPageX = document.body.scrollLeft; myPageY = document.body.scrollTop; } else{ myPageX = window.pageXOffset; myPageY = window.pageYOffset; } document.Form1.PageX.value = myPageX; document.Form1.PageY.value = myPageY; }
- add onscroll and onload events of your page body3) add this below html text boxes in between your form tags
- add onscroll and onload events of your page body3) add this below html text boxes in between your form tags
-
I have a page containing a datagrid with the first column selectable. If a record is selected, information for that record will be shown on the right. The page is quite long due the large amount of information (thus, long list of data in the datagrid). The problem is when i select a record at the bottom (or lower than a page), the page brings me back to the top of the page. Actually, this is not really a problem. It's just annoying/not working as i want it to. So i wonder if there's a way to set a focus to a specific control e.g. the clicked record or any better way to make it stay where i want. KiT
Put this code inside the html head tags of the page that you are having problems with: window.onload = function(){ var strCook = document.cookie; if(strCook.indexOf("!~")!=0){ var intS = strCook.indexOf("!~"); var intE = strCook.indexOf("~!"); var strPos = strCook.substring(intS+2,intE); document.body.scrollTop = strPos; } } function SetScrollPosition(){ var intY = document.body.scrollTop; document.title = intY; document.cookie = "yPos=!~" + intY + "~!"; } window.onscroll = SetScrollPosition; HTH Royal Systems For web design and network solutions