C# HtmlGenericControl

C

Coder Coder

Hi.

I have an aspx page which has a datagrid sitting inside of DIV tags.

The users can now scroll down to look at the all the items in the
datagrid.
The only problem is that when a selection is made and the page is
reloaded the scrollbar of the DIV tag goes back up to the top. So the
user has to scroll back down again to see the previous selection.

I have tried SmartNavigation but that didnt do the trick.
I have used:

Control cont = null;
cont = Page.FindControl ("mydiv");
if (cont == null)
{
alert.Text = "control not found";
}
else
{
alert.Text = "control found";
}

mydiv = (HtmlGenericControl) cont;

This tells me that the control was FOUND so, I then do the
following:

int newLocation = DataGrid.SelectedIndex * 20;
mydiv.Attributes.Add ("scrollTop", newLocation);


However the scroll bars of the DIV dont move.

In javascript if you do the following:

var sp = document.getElementById('mydiv');
sp.scrollTop = 150;

It moves the scrolls.

But I need to do it in the code behind to see which index was
selected.

- Thanks
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top