C# HtmlGenericControl

Posted: 07-30-2003, 12:19 AM
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
Reply With Quote

Responses to "C# HtmlGenericControl"

Natty Gur
Guest
Posts: n/a
 
Re: C# HtmlGenericControl
Posted: 07-30-2003, 04:13 AM
Hi,

Consider using scrollintoview DHTML method. You can embed it into the
html using RegisterStartupScript.

http://msdn.microsoft.com/library/de...p/author/dhtml
/reference/methods/scrollintoview.asp

Natty Gur, CTO
Dao2Com Ltd.
28th Baruch Hirsch st. Bnei-Brak
Israel , 51114

Phone Numbers:
Office: +972-(0)3-5786668
Fax: +972-(0)3-5703475
Mobile: +972-(0)58-888377

Know the overall picture


*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Reply With Quote
Natty Gur
Guest
Posts: n/a
 
Re: C# HtmlGenericControl
Posted: 07-30-2003, 04:23 AM
Hi,

Consider using scrollintoview DHTML method. You can embed it into the
html using RegisterStartupScript.

http://msdn.microsoft.com/library/de...p/author/dhtml
/reference/methods/scrollintoview.asp

Natty Gur, CTO
Dao2Com Ltd.
28th Baruch Hirsch st. Bnei-Brak
Israel , 51114

Phone Numbers:
Office: +972-(0)3-5786668
Fax: +972-(0)3-5703475
Mobile: +972-(0)58-888377

Know the overall picture


*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Reply With Quote
 
LinkBack Thread Tools Search this Thread Display Modes
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump