AUTHOR: Marin Bratanov
DATE POSTED: December 22, 2017
Set RadListView Height.
This would allow you, for example, to define a responsive layout or to let it fill its container height to 100%.
You must define a container for the items with the desired settings inside the LayoutTemplate, because RadListView does not render a wrapping element over its items.
For example
<
div
class
=
"contentContainer"
>
telerik:RadListView
ItemPlaceholderID
"Placeholder1"
ID
"RadListView"
RenderMode
"Lightweight"
runat
"server"
OnNeedDataSource
"RadListView1_NeedDataSource"
LayoutTemplate
style
"height: 100%; background: yellow; overflow: auto;"
id
"listViewLayout"
asp:PlaceHolder
/>
</
ItemTemplate
"margin: 5px 0px 8px 0px; border: 1px solid black;"
<%# Eval("ID") %>
add some styling to match your needs, this will make the listview be 50% of the page:
<style>
html, body, form {
margin
:
0
;
padding
height
100%
overflow
hidden
}
.contentContainer {
width
50%
</style>
and add some dummy data in the control:
protected
void
RadListView1_NeedDataSource(
object
sender, RadListViewNeedDataSourceEventArgs e)
{
(sender
as
RadListView).DataSource = GetGridSource();
private
DataTable GetGridSource()
DataTable dataTable =
new
DataTable();
DataColumn column =
DataColumn();
column.DataType = Type.GetType(
"System.Int32"
);
column.ColumnName =
"ID"
dataTable.Columns.Add(column);
for
(
int
i = 0; i <= 100; i++)
DataRow row = dataTable.NewRow();
row[
] = i + 1;
dataTable.Rows.Add(row);
return
dataTable;
Resources Buy Try