I've been struggling with this for 2 days now. How the heck do you handle scroll repositioning of a <div> after a postback of an ASP.NET web page?
I have a gridview inside a div. Scrolling through the gridview is actually being handled by scrolling through the div. Gridview controls don't have a scrollbar property.
Let's say that I scroll down to the 100th record of the gridview and click a button in there. I successfully handle the SelectedIndexChanged event and retrieve data from the gridview at that row.
Once the postback concludes, however, the position where I was in the div is lost and it positions itself at the top. That behavior is very annoying to the users because they have to manually scroll to the row they were at. Fortunately, I change the color scheme on the selected row so that can at least find where they were.
I've found dozens of developer forums where folks have posed this same question. Solutions range from java script to jquery. I've tried them and nothing works. All of the javascript solutions make reference to a scrollTop property for the div. That property doesn't even exist! I don't have access to jquery so wouldn't have any idea how to implement that.
My web page is embedded in a master page if this helps.
Does anyone have a solution for this problem?
Thanks in advance,
Jerry
Jerry Scannell
I have a gridview inside a div. Scrolling through the gridview is actually being handled by scrolling through the div. Gridview controls don't have a scrollbar property.
Let's say that I scroll down to the 100th record of the gridview and click a button in there. I successfully handle the SelectedIndexChanged event and retrieve data from the gridview at that row.
Once the postback concludes, however, the position where I was in the div is lost and it positions itself at the top. That behavior is very annoying to the users because they have to manually scroll to the row they were at. Fortunately, I change the color scheme on the selected row so that can at least find where they were.
I've found dozens of developer forums where folks have posed this same question. Solutions range from java script to jquery. I've tried them and nothing works. All of the javascript solutions make reference to a scrollTop property for the div. That property doesn't even exist! I don't have access to jquery so wouldn't have any idea how to implement that.
My web page is embedded in a master page if this helps.
Does anyone have a solution for this problem?
Thanks in advance,
Jerry
Jerry Scannell