473,503 Members | 2,165 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="Vertical" >
<table width="100%" style="border: 1px solid; border-color: Blue"
border="0" cellpadding="0" cellspacing="0" >
<tr>
<td>

<asp:datalist id="dlTemplateList" style="width: 100%;"
datakeyfield="ItemID" runat="server"
cellpadding="1" OnItemDataBound="dlTemplateList_ItemDataBound">
<itemtemplate>
<table class="dataliststyle">
<tr>
<td valign="top" align="left" style="width:30px">
<asp:ImageButton ID="ImageButton1" runat="server"
ImageUrl="~/images/icon_sitelog_16px.gif"
onclick="ImageButton1_Click"/>

</td>
<td style="width:320px" class="reportname">
<asp:HyperLink ID="HyperLinkReport" Runat="Server"
Text='<%# DataBinder.Eval(Container.DataItem, "ObjectName") %>'
NavigateUrl='~/DesktopModules/Report/Viewer.aspx?ReportID=<%#
DataBinder.Eval(Container.DataItem, "ItemID") %>'
Target="_top"
/>

<asp:Label ID="lblContent1" runat="server" CssClass="Normal"/>
</td>
<td>
<span id="spanInModuleB" style="overflow:auto; ">
<asp:Label ID="Label1" runat="server" CssClass="description"
Text='<%# DataBinder.Eval(Container.DataItem, "Description") %>'/>

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

</itemtemplate>

</asp:datalist>

Jun 27 '08 #1
3 5800
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****@microsoft.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="Vertical"

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

<asp:datalist id="dlTemplateList" style="width: 100%;"
datakeyfield="ItemID" runat="server"
cellpadding="1" OnItemDataBound="dlTemplateList_ItemDataBound">
<itemtemplate>
<table class="dataliststyle">
<tr>
<td valign="top" align="left" style="width:30px">
<asp:ImageButton ID="ImageButton1" runat="server"
ImageUrl="~/images/icon_sitelog_16px.gif"
onclick="ImageButton1_Click"/>

</td>
<td style="width:320px" class="reportname">
<asp:HyperLink ID="HyperLinkReport" Runat="Server"
Text='<%# DataBinder.Eval(Container.DataItem, "ObjectName") %>'
NavigateUrl='~/DesktopModules/Report/Viewer.aspx?ReportID=<%#
DataBinder.Eval(Container.DataItem, "ItemID") %>'
Target="_top"
/>

<asp:Label ID="lblContent1" runat="server" CssClass="Normal"/>
</td>
<td>
<span id="spanInModuleB" style="overflow:auto; ">
<asp:Label ID="Label1" runat="server" CssClass="description"
Text='<%# DataBinder.Eval(Container.DataItem, "Description") %>'/>

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

</itemtemplate>

</asp:datalist>

Jun 27 '08 #2
Thank you very much, it works great!
"Steven Cheng [MSFT]" <st*****@online.microsoft.comwrote in message
news:qB**************@TK2MSFTNGHUB02.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****@microsoft.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="Vertical"

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

<asp:datalist id="dlTemplateList" style="width: 100%;"
datakeyfield="ItemID" runat="server"
cellpadding="1" OnItemDataBound="dlTemplateList_ItemDataBound">
<itemtemplate>
<table class="dataliststyle">
<tr>
<td valign="top" align="left" style="width:30px">
<asp:ImageButton ID="ImageButton1" runat="server"
ImageUrl="~/images/icon_sitelog_16px.gif"
onclick="ImageButton1_Click"/>

</td>
<td style="width:320px" class="reportname">
<asp:HyperLink ID="HyperLinkReport" Runat="Server"
Text='<%# DataBinder.Eval(Container.DataItem, "ObjectName")
%>'
NavigateUrl='~/DesktopModules/Report/Viewer.aspx?ReportID=<%#
DataBinder.Eval(Container.DataItem, "ItemID") %>'
Target="_top"
/>

<asp:Label ID="lblContent1" runat="server" CssClass="Normal"/>
</td>
<td>
<span id="spanInModuleB" style="overflow:auto; ">
<asp:Label ID="Label1" runat="server" CssClass="description"
Text='<%# DataBinder.Eval(Container.DataItem, "Description") %>'/>

</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
2819
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...
4
4819
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...
6
2175
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...
0
1979
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...
4
2185
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...
0
1056
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...
0
1243
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...
1
1876
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...
1
1906
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...
0
7093
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...
0
7287
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,...
0
7353
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
7011
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7468
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5596
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,...
0
4689
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...
0
1521
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 ...
0
401
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.