473,378 Members | 1,462 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,378 software developers and data experts.

C# HtmlGenericControl

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
Nov 17 '05 #1
2 6994
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!
Nov 17 '05 #2
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!
Nov 17 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Coder Coder | last post by:
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...
3
by: Josema | last post by:
Hi, I have in a database models of cars, CarID int CarName varchar CarFeatures varchar CarImage binary I have a class Car that have the properties:
0
by: VB Programmer | last post by:
I have 2 webforms. When I print out the page.Controls(1).tostring variable one says "HtmlForm", the other "HtmlGenericControl". How can I change the first one to "HtmlForm"? ?...
0
by: Ramdas | last post by:
I have a HTMLGeneric control In my Aspx page inside my Form tag ------------------------------ <xml id="myControl" name="myControl" runat="server"></xml> In code behind --------------...
2
by: Ralph Krausse | last post by:
I am updating a span tag with the title of my expanded node (a 3rd party control).text that I wish to get later in my codebehind file. my tag in my html <span class="hint" runat="server"...
4
by: qualitynice | last post by:
HELP :-)... I'm creating an embedded activex object in an asp.net page using the HtmlGenericControl class. I'm doing this because when I tried to embed it directly in the aspx page, it stopped...
8
by: Randall Parker | last post by:
I want to generate an HTML tag that will look like: <a href="EquipmentServiceCreate.aspx?serial=X01">Create New Service For X01</a> or on a different instance where the user would be viewing...
2
by: Rik Brooks | last post by:
I have a web page that has a placeholder on it called PlaceHolderText. I read some html out of the database. The value for my test is: this is <strong>a test </strongof the html stuff I read...
0
by: papillonhn | last post by:
Please help me. In my HtmlGenericControl object has: an image and a string. Is there anyway to determine or calculate the width of HtmlGenericControl. I need to display this HtmlGenericControl...
2
by: swathi amireddy | last post by:
Hi Experts, //BodyID Defined as in other page where method ControlWebPage(HtmlGenericControl BodyID) in OnInit method protected System.Web.UI.HtmlControls.HtmlGenericControl BodyID; ...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.