6 Answers, 1 is accepted
0

Shinu
Top achievements
Rank 2
answered on 04 Jun 2012, 10:37 AM
Hi Julie,
I could replicate the issue when i have set the height of the RadGrid or MasterTableView and if there is no records to display. Please try setting the height of the NoRecordTemplate using css, to place the footer as per the height of the Radgrid.
ASPX:
CSS:
Thanks,
Shinu.
I could replicate the issue when i have set the height of the RadGrid or MasterTableView and if there is no records to display. Please try setting the height of the NoRecordTemplate using css, to place the footer as per the height of the Radgrid.
ASPX:
<
telerik:RadGrid
ID
=
"RadGrid1"
Height
=
"500px"
>
CSS:
<style type=
"text/css"
>
.RadGrid .rgNoRecords
{
height
:
415px
! important;
}
.rgNoRecords td
{
position
:
absolute
!important
;
margin-top
:
0px
!important
;
}
</style>
Thanks,
Shinu.
0

Julie
Top achievements
Rank 1
answered on 19 Jul 2012, 12:10 PM
It works prefectly when there is no record.
But, for 1 or 2 record, the min-height property doesn't work and the footer goes next to the last line.
How can I fix that problem ?
Thanks a lot.
Julie
But, for 1 or 2 record, the min-height property doesn't work and the footer goes next to the last line.
How can I fix that problem ?
Thanks a lot.
Julie
0

Vasssek
Top achievements
Rank 1
answered on 20 Jul 2012, 06:29 AM
Hello Julie,
this works in my case.
1. You need set some javascript code which will fire when radgrid is created:
2. Then you need to set height in aspx radgrid clientsection declaration:
In the attachement, there are two pictures. First has 16 rows, which points to 642px height. Second has just 5 rows and as you can see, radgrid height is adjust properly...
I hope the information I have provided will help you a bit...
Best regards
Vasssek
this works in my case.
1. You need set some javascript code which will fire when radgrid is created:
<
telerik:RadCodeBlock
ID
=
"RadCodeBlock1"
runat
=
"server"
>
<
script
type
=
"text/javascript"
>
function GridCreated(sender, args) {
var scrollArea = sender.GridDataDiv;
var dataHeight = sender.get_masterTableView().get_element().clientHeight;
if (dataHeight <
642
) {
if (scrollArea.scrollWidth != scrollArea.clientWidth)
scrollArea.style.height
=
dataHeight
+ 18 + "px";
else
scrollArea.style.height
=
dataHeight
+ 1 + "px";
}
}
</script>
</
telerik:RadCodeBlock
>
2. Then you need to set height in aspx radgrid clientsection declaration:
<
ClientSettings
EnableRowHoverStyle
=
"true"
ReorderColumnsOnClient
=
"True"
AllowColumnsReorder
=
"True"
>
<
Selecting
AllowRowSelect
=
"true"
/>
<
Scrolling
AllowScroll
=
"true"
ScrollHeight
=
"642px"
UseStaticHeaders
=
"false"
/>
<
ClientEvents
OnGridCreated
=
"GridCreated"
/>
</
ClientSettings
>
</
telerik:RadGrid
>
In the attachement, there are two pictures. First has 16 rows, which points to 642px height. Second has just 5 rows and as you can see, radgrid height is adjust properly...
I hope the information I have provided will help you a bit...
Best regards
Vasssek
0

Shinu
Top achievements
Rank 2
answered on 20 Jul 2012, 07:27 AM
Hi Julie,
Try the following code snippet
C#:
Thanks,
Shinu.
Try the following code snippet
C#:
protected
void
Radr_PreRender(
object
sender, EventArgs e)
{
int
c = Radr.Items.Count;
Radr.MasterTableView.FooterStyle.Height =
new
Unit(c * 20 + 290);
Radr.MasterTableView.Height =
new
Unit(c * 20 + 450);
}
Thanks,
Shinu.
0

Matthew
Top achievements
Rank 1
answered on 06 Mar 2014, 04:40 PM
I ran across this same problem and none of the above solutions helped me. I did find a solution to my problem and figured I'd post it incase anyone else had the same requirements as mine. I have a area with a min height. The radgrid is inside this area. I needed the grid to fill the min height if the number of items did not cause the grid to fill the area. Then the grid needed to keep expanding vertically as more items were added. Setting the grid hight directly was causing the column filter row to distort. I was able to fix this issue by setting the scroll height info on page load, only when the minimun number of required to fill the grid was not met (meaning scroll bars are not shown and will be removed before they would appear). So as long as there are 6 or fewer items(partially filled grid) there is a scroll height with hidden scroll bars, then once the next item is added the scroll height is no longer added and the grid continues to expand vertically.
protected
void
GridPreRender(
object
sender, EventArgs e)
{
int
c = Grid.Items.Count;
if
(c < 7)
{
Grid.ClientSettings.Scrolling.AllowScroll =
true
;
Grid.ClientSettings.Scrolling.UseStaticHeaders =
true
;
Grid.ClientSettings.Scrolling.ScrollHeight =
new
Unit(
"335px"
);
}
}
0
Hello Matthew,
Thank you for sharing your solution. I'm sure it will be of a big help for other users that are facing the same issue.
Regards,
Maria Ilieva
Telerik
Thank you for sharing your solution. I'm sure it will be of a big help for other users that are facing the same issue.
Regards,
Maria Ilieva
Telerik
DevCraft Q1'14 is here! Watch the online conference to see how this release solves your top-5 .NET challenges. Watch on demand now.