473,835 Members | 1,754 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Set Datalist height dynamically

I have a datalist and I want the datalist to grow from no records to fill
the
screen, but not go beyond the screen height. How do I do that?
I've implemented the scroll bars but it works only for the fixed height. I
want
the datalist to grow and shrink and never go beyond the current screen
height, if the data can not fit in one screen I want to implement scroll
bars, but only scroll the datalist not any other parts.

Thank You

Peter
Here's my code, I've tried adding a table, but still can not get it to work.

<asp:Panel ID="Panel1" runat="server" height="300px" ScrollBars="Ver tical" >
<table width="100%" style="border: 1px solid; border-color: Blue"
border="0" cellpadding="0" cellspacing="0" >
<tr>
<td>

<asp:datalist id="dlTemplateL ist" style="width: 100%;"
datakeyfield="I temID" runat="server"
cellpadding="1" OnItemDataBound ="dlTemplateLis t_ItemDataBound ">
<itemtemplate >
<table class="datalist style">
<tr>
<td valign="top" align="left" style="width:30 px">
<asp:ImageButto n ID="ImageButton 1" runat="server"
ImageUrl="~/images/icon_sitelog_16 px.gif"
onclick="ImageB utton1_Click"/>

</td>
<td style="width:32 0px" class="reportna me">
<asp:HyperLin k ID="HyperLinkRe port" Runat="Server"
Text='<%# DataBinder.Eval (Container.Data Item, "ObjectName ") %>'
NavigateUrl='~/DesktopModules/Report/Viewer.aspx?Rep ortID=<%#
DataBinder.Eval (Container.Data Item, "ItemID") %>'
Target="_top"
/>

<asp:Label ID="lblContent1 " runat="server" CssClass="Norma l"/>
</td>
<td>
<span id="spanInModul eB" style="overflow :auto; ">
<asp:Label ID="Label1" runat="server" CssClass="descr iption"
Text='<%# DataBinder.Eval (Container.Data Item, "Descriptio n") %>'/>

</span>
</td>
</tr>
</table>

</itemtemplate>

</asp:datalist>

Jun 27 '08 #1
3 5821
Hi Peter,

From your description, you're wantting to make a DataList's height grows
dynamically and when it reach a certain maxmium limitation make it become
scrollable, correct?

As for scrolling datalist, I have a idea that use a <divto wrapper your
DataList, thus, you can apply style on the DIV so that it will display
scrollbar when its inner content exceed its height.

#WWW FAQs: How do I add a scrollbar to part of a page?
http://www.boutell.com/newfaq/creating/scrolling.html

#how to get a scrollbar on a div-section in an html-page?
http://quomon.com/question_how_scrol..._page_901.aspx

And you may need to adjust the div's height according to your current
page's height. You may consider use client script to get document body
height. How do you think?

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead
Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
ms****@microsof t.com.

=============== =============== =============== =====
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscripti...ult.aspx#notif
ications.

=============== =============== =============== =====
This posting is provided "AS IS" with no warranties, and confers no rights.

--------------------
>From: "Peter" <cz****@nospam. nospam>
Subject: Set Datalist height dynamically
Date: Thu, 17 Apr 2008 23:20:15 -0500

I have a datalist and I want the datalist to grow from no records to fill
the
screen, but not go beyond the screen height. How do I do that?
I've implemented the scroll bars but it works only for the fixed height.
I
>want
the datalist to grow and shrink and never go beyond the current screen
height, if the data can not fit in one screen I want to implement scroll
bars, but only scroll the datalist not any other parts.

Thank You

Peter
Here's my code, I've tried adding a table, but still can not get it to
work.
>
<asp:Panel ID="Panel1" runat="server" height="300px" ScrollBars="Ver tical"

<table width="100%" style="border: 1px solid; border-color: Blue"
border="0" cellpadding="0" cellspacing="0" >
<tr>
<td>

<asp:datalis t id="dlTemplateL ist" style="width: 100%;"
datakeyfield=" ItemID" runat="server"
cellpadding="1" OnItemDataBound ="dlTemplateLis t_ItemDataBound ">
<itemtemplate >
<table class="datalist style">
<tr>
<td valign="top" align="left" style="width:30 px">
<asp:ImageButto n ID="ImageButton 1" runat="server"
ImageUrl="~/images/icon_sitelog_16 px.gif"
onclick="ImageB utton1_Click"/>

</td>
<td style="width:32 0px" class="reportna me">
<asp:HyperLin k ID="HyperLinkRe port" Runat="Server"
Text='<%# DataBinder.Eval (Container.Data Item, "ObjectName ") %>'
NavigateUrl='~/DesktopModules/Report/Viewer.aspx?Rep ortID=<%#
DataBinder.Eva l(Container.Dat aItem, "ItemID") %>'
Target="_top"
/>

<asp:Label ID="lblContent1 " runat="server" CssClass="Norma l"/>
</td>
<td>
<span id="spanInModul eB" style="overflow :auto; ">
<asp:Label ID="Label1" runat="server" CssClass="descr iption"
Text='<%# DataBinder.Eval (Container.Data Item, "Descriptio n") %>'/>

</span>
</td>
</tr>
</table>

</itemtemplate>

</asp:datalist>

Jun 27 '08 #2
Thank you very much, it works great!
"Steven Cheng [MSFT]" <st*****@online .microsoft.comw rote in message
news:qB******** ******@TK2MSFTN GHUB02.phx.gbl. ..
Hi Peter,

From your description, you're wantting to make a DataList's height grows
dynamically and when it reach a certain maxmium limitation make it become
scrollable, correct?

As for scrolling datalist, I have a idea that use a <divto wrapper your
DataList, thus, you can apply style on the DIV so that it will display
scrollbar when its inner content exceed its height.

#WWW FAQs: How do I add a scrollbar to part of a page?
http://www.boutell.com/newfaq/creating/scrolling.html

#how to get a scrollbar on a div-section in an html-page?
http://quomon.com/question_how_scrol..._page_901.aspx

And you may need to adjust the div's height according to your current
page's height. You may consider use client script to get document body
height. How do you think?

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead
Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
ms****@microsof t.com.

=============== =============== =============== =====
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscripti...ult.aspx#notif
ications.

=============== =============== =============== =====
This posting is provided "AS IS" with no warranties, and confers no
rights.

--------------------
>>From: "Peter" <cz****@nospam. nospam>
Subject: Set Datalist height dynamically
Date: Thu, 17 Apr 2008 23:20:15 -0500

I have a datalist and I want the datalist to grow from no records to fill
the
screen, but not go beyond the screen height. How do I do that?
I've implemented the scroll bars but it works only for the fixed height.
I
>>want
the datalist to grow and shrink and never go beyond the current screen
height, if the data can not fit in one screen I want to implement scroll
bars, but only scroll the datalist not any other parts.

Thank You

Peter
Here's my code, I've tried adding a table, but still can not get it to
work.
>>
<asp:Panel ID="Panel1" runat="server" height="300px" ScrollBars="Ver tical"

<table width="100%" style="border: 1px solid; border-color: Blue"
border="0" cellpadding="0" cellspacing="0" >
<tr>
<td>

<asp:datali st id="dlTemplateL ist" style="width: 100%;"
datakeyfield= "ItemID" runat="server"
cellpadding="1" OnItemDataBound ="dlTemplateLis t_ItemDataBound ">
<itemtemplate >
<table class="datalist style">
<tr>
<td valign="top" align="left" style="width:30 px">
<asp:ImageButto n ID="ImageButton 1" runat="server"
ImageUrl="~/images/icon_sitelog_16 px.gif"
onclick="ImageB utton1_Click"/>

</td>
<td style="width:32 0px" class="reportna me">
<asp:HyperLin k ID="HyperLinkRe port" Runat="Server"
Text='<%# DataBinder.Eval (Container.Data Item, "ObjectName ")
%>'
NavigateUrl='~/DesktopModules/Report/Viewer.aspx?Rep ortID=<%#
DataBinder.Ev al(Container.Da taItem, "ItemID") %>'
Target="_top"
/>

<asp:Label ID="lblContent1 " runat="server" CssClass="Norma l"/>
</td>
<td>
<span id="spanInModul eB" style="overflow :auto; ">
<asp:Label ID="Label1" runat="server" CssClass="descr iption"
Text='<%# DataBinder.Eval (Container.Data Item, "Descriptio n") %>'/>

</span>
</td>
</tr>
</table>

</itemtemplate>

</asp:datalist>


Jun 27 '08 #3
You're welcome :)

Sincerely,

Steven Cheng
Microsoft MSDN Online Support Lead

Jun 27 '08 #4

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

Similar topics

10
2862
by: Bharat | last post by:
Hi Folks, Suppose I have two link button on a page (say lnkBtn1 and lnkBtn2). On the click event of the lnkbtn1 I have to add a dynamically created control. And On the click event of the lnkBtn2 I have to add a datalist control. Using this datalist control I should be able to add edit, modify and cancel the items listed in this control. Here is how I designed. I used placeholder to add the controls dynamically to the page on the click...
4
4846
by: Miguel Dias Moura | last post by:
Hello, I created a datalist in an ASP.Net / VB page. I display the image and price of a few products. When a user clicks an image I want to load the page "detail.aspx?number=id" and send the value of the "id" field of that record as a URL parameter. Can someone tell me how to do this.
6
2194
by: tshad | last post by:
I need to get to a status label I have on my footer section of my datalist. There is no event happening that would go to the footer. I am just doing some processing and want to update the label on the footer. At the moment, I go through the dataListItems like so: for each oItem as DataListItem in DataList1.Items trace.warn("inside for loop oItem type = " & oItem.itemType.ToString())
0
2010
by: mharness | last post by:
Hello All, Does anyone know how to dynamically change the width and height properties of an image in a datalist in order to maintain the original aspect ratio? I've managed to do this with a single image (see below) but don't have a clue how to apply the same approach in a datalist, perhaps with a custom databinding expression (or what?). I would also prefer not displaying the image if it's blank so being able to
4
2208
by: .Net Sports | last post by:
I need to dynamically assign a datalist attribute upon a helper function receiving data from a querystring. If a user picks a certain region, i need the datalist to display its back color, or any of its other objects , as a certain color or css style <HeaderStyle BackColor="<%= ssponcont %>"</HeaderStyle> ....doesnot work as a Parser error renders: Content ('<HeaderStyle
0
1071
by: Peter | last post by:
I have a datalist and I want the datalist to grow from no recors to fill the screen, but not go beyond the screen height. How do I do that? I've implemented the scroll bars but that's for the fixed height. I want the datalist to grow and shrink and never go beyond the current screen height, if it goes beyond the screen height I want to implement the scroll bar. Thank You
0
1257
by: =?Utf-8?B?Vmlua2k=?= | last post by:
Hello Everyone, I am having this problem. I have this datalist and whenever I expand the datalist by the plus button, it overlaps other controls on my web page and sometimes these controls come over the dataList. Bleow is the code <table width="100%"> <tr> <td>
1
1891
by: Brock | last post by:
First note that I am using Framework 1.1. I have an .aspx page that is displaying a list of employees, but only the Employee Number, First Name, Last Name, and Title. It is working great. I recessed it in a <Div></Divto allow scrolling of just the data, not the page. What I need to do is place a DataList (also in a <Div></Divto allow scrolling of just the data) to the right of the Datagrid to show 40 Employee Detail fields (listed top to...
1
1926
by: Brock | last post by:
Thanks in advance... (you can see a screenshot of what my form looks like currently at http://www.juggernautical.com/DataGrid.jpg - the Datalist is super-imposed in 'design view' but the DataGrid is the actual running of the page) I've almost got this working (?) but need a little help. I have an .aspx page that has a DataGrid listing employees with a "Select" button that is to be used to populate the DataList to the right of the DataGrid...
0
9808
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9652
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10812
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9346
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7766
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6966
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5638
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4434
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3995
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.