Home » Asp.netRSS

Gridview row after postback

i have a grid from 1000 row

i need to stay in the same row  after clicking the template edit or update instead of scrolling down and up searching wich row is in edit mode

somebody help plz

 

7 Answers Found

 

Answer 1

Try looking for MaintainScrollPositionOnPostBack.
 

Answer 2

Hi man

i did but nothing

cause i am using ajax update pannel 

 

Answer 3

Hi Samriko,

You can try following method.

First you can put a your controls inside <div> tag like below

<div style="display:inline; overflow: auto;" id="scrollArea" onscroll="javascript:setScroll(this);">

...Your form contents

</div>

<input type="hidden" id="scrollPos" name="scrollPos" value="0" runat="server"/>  Hidden control 

Next step 

you have to write Java script as follows

function setScroll(val) {
document.form1.scrollPos.value = val.scrollTop;
}
function scrollTo(what) {
document.getElementById(what).scrollTop =
document.form1.scrollPos.value;
}


function setScroll(val) {

document.form1.scrollPos.value = val.scrollTop;

}

function scrollTo(what) {

document.getElementById(what).scrollTop =

document.form1.scrollPos.value;

}

add body on load as below

<body onload="javascript:scrollTo('scrollArea')"  >

It should work...Hope this helps..
If you need any help let me know..

Mansoor

 

Answer 4

Thanks Mansour i let you know the result 2moro ya man ! 

 

Answer 5

Hi man

 

i tried  it s working on the second click on another edit

first time editing i will have to scroll down or up

any idea? please post another example or full code

gridview inside upadate panel all inside Div

 

Answer 6

Hi Samirko,

Try my solution in your another post: http://forums.asp.net/t/1617239.aspx

Thanks,

 

Answer 7

Qin Dian Tang You are the man,

but you need to tell me why is page freezing for  5 seconds on edit click or update or cancel clicks

can you please fix it for me?

 
 
 

<< Previous      Next >>


Microsoft   |   Windows   |   Visual Studio   |   Follow us on Twitter