Set Datalist height dynamically

Set Datalist height dynamically

am 18.04.2008 06:20:15 von Peter

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.


border="0" cellpadding="0" cellspacing="0" >



datakeyfield="ItemID" runat="server"
cellpadding="1" OnItemDataBound="dlTemplateList_ItemDataBound">








ImageUrl="~/images/icon_sitelog_16px.gif"
onclick="ImageButton1_Click"/>


Text='<%# DataBinder.Eval(Container.DataItem, "ObjectName") %>'
NavigateUrl='~/DesktopModules/Report/Viewer.aspx?ReportID=<%#
DataBinder.Eval(Container.DataItem, "ItemID") %>'
Target="_top"
/>




Text='<%# DataBinder.Eval(Container.DataItem, "Description") %>'/>






RE: Set Datalist height dynamically

am 18.04.2008 11:12:42 von stcheng

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

to 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_scrollbar_div_section_html_pa ge_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:
msdnmg@microsoft.com.

==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscriptions/managednewsgroups/de fault.aspx#notif
ications.

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



--------------------
>From: "Peter"
>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.
>
> >
> >border="0" cellpadding="0" cellspacing="0" >
>
>

>
> >datakeyfield="ItemID" runat="server"
> cellpadding="1" OnItemDataBound="dlTemplateList_ItemDataBound">
>
>
>
>
>
>
>
>

> >ImageUrl="~/images/icon_sitelog_16px.gif"
> onclick="ImageButton1_Click"/>
>
>

> > Text='<%# DataBinder.Eval(Container.DataItem, "ObjectName") %>'
> NavigateUrl='~/DesktopModules/Report/Viewer.aspx?ReportID=<%#
>DataBinder.Eval(Container.DataItem, "ItemID") %>'
> Target="_top"
> />
>
>
>

>
> >Text='<%# DataBinder.Eval(Container.DataItem, "Description") %>'/>
>
>

>

>
>

>
>

>
>
>
>

Re: Set Datalist height dynamically

am 18.04.2008 15:43:46 von Peter

Thank you very much, it works great!


"Steven Cheng [MSFT]" wrote in message
news:qBtdhRToIHA.4932@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

to 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_scrollbar_div_section_html_pa ge_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:
> msdnmg@microsoft.com.
>
> ==================================================
> Get notification to my posts through email? Please refer to
> http://msdn.microsoft.com/subscriptions/managednewsgroups/de fault.aspx#notif
> ications.
>
> ==================================================
> This posting is provided "AS IS" with no warranties, and confers no
> rights.
>
>
>
> --------------------
>>From: "Peter"
>>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.
>>
>> >>
>> >>border="0" cellpadding="0" cellspacing="0" >
>>
>>

>>
>> >>datakeyfield="ItemID" runat="server"
>> cellpadding="1" OnItemDataBound="dlTemplateList_ItemDataBound">
>>
>>
>>
>>
>>
>>
>>
>>

>> >>ImageUrl="~/images/icon_sitelog_16px.gif"
>> onclick="ImageButton1_Click"/>
>>
>>

>> >> Text='<%# DataBinder.Eval(Container.DataItem, "ObjectName")
>> %>'
>> NavigateUrl='~/DesktopModules/Report/Viewer.aspx?ReportID=<%#
>>DataBinder.Eval(Container.DataItem, "ItemID") %>'
>> Target="_top"
>> />
>>
>>
>>

>>
>> >>Text='<%# DataBinder.Eval(Container.DataItem, "Description") %>'/>
>>
>>

>>

>>
>>

>>
>>

>>
>>
>>
>>
>

Re: Set Datalist height dynamically

am 21.04.2008 03:42:46 von stcheng

You're welcome :)

Sincerely,

Steven Cheng
Microsoft MSDN Online Support Lead