28 Nisan 2009 Salı

Adding a Scrollbar

It's very easy to add a scrollbar for some items you want to display on the page.

The following code is implemented in .NET environment:

For example you have a datalist and you want to display a number of items at first sight, so that user can scroll down to see more items.
In the designer part you should do the following:







Then, in the code (it can be page_load event) you write the following code:

if (dl.Items.Count > someNumber)
{
datalist.Style.Add("height", "200px");

datalist.Style.Add("overflow", "auto");

}
You should change 200px to whatever is appropriate for your implementation.

If the datalist has more than "someNumber" items, then the following is observed:

Hiç yorum yok: