I realize this question has been asked numerous times before and I've done my best to go through each forum post that asked a similar question, I've done various google searches, and I've even given my best shot to achieve my desired result. Unfortunately, I haven't been successful in achieving my desired result.
What I'm trying to do is set the height of the grid to be 100% of the remaining space of its parent container. Here's a screenshot of what my page looks like:
http://img56.imageshack.us/img56/5597/data.jpg
As you can see, there is a few pixels below the grid that is not being utilized. I'm aware that 100% height is relative to its parent container and I've setup the CSS to accommodate that requirement:
For simplicity, I've replaced the various server controls in my screen shot w/ an empty div that consumes about the same amount of height. Here's what the markup looks like:
When the HTML above is rendered, the grid itself is wrapped in a div w/ an ID similar to <gridID>GridPanel or something similar. Upon inspection, this is due to my utilization of the RadAjaxManager (at least that's what I've concluded).
The RadAjaxManager itself doesn't expose any css related properties where I can specify the div that it renders to have a height of 100%. W/ a little jQuery, I tried something like:
$("#itemizedChargeTypeGrid").parent().css("height", "100%")
which stretched the parent container of the grid to be 100%; however, the data w/ in the grid itself still remained a fixed height. Upon reviewing the markup emitted by the RadGrid, I noticed the data was rendered in a div w/ an id similar to <gridID>_GridData. And so I thought, why not set the height of the class of that element to be 100%.
After doing so, the grid stretched; however, it appeared scrollbar functionality was lost. Forgive me for a long winded explanation, but ultimately my question is:
How can I get the grid to dynamically stretch vertically to fit the remainder of its parent container while retaining the ability to have records not immediately visible to be scrolled into view?
What I'm trying to do is set the height of the grid to be 100% of the remaining space of its parent container. Here's a screenshot of what my page looks like:
http://img56.imageshack.us/img56/5597/data.jpg
As you can see, there is a few pixels below the grid that is not being utilized. I'm aware that 100% height is relative to its parent container and I've setup the CSS to accommodate that requirement:
| html, body, form |
| { |
| margin: 0px; |
| padding: 0px; |
| height: 100%; |
| } |
| html { border: solid 1px red; } |
| body { border: solid 1px blue; } |
| form { border: solid 2px orange; } |
| #contentts |
| { |
| width: 800px; |
| height: 100%; |
| } |
For simplicity, I've replaced the various server controls in my screen shot w/ an empty div that consumes about the same amount of height. Here's what the markup looks like:
| <div id="contents"> |
| <div style="height: 100px; border: solid 1px black;"> |
| Filter Controls go here |
| </div> |
| <rad:RadGrid ID="itemizedChargeTypeGrid" runat="server" DataSourceID="itemizedChargeTypeODS" |
| Height="500px" PagerStyle-AlwaysVisible="true" AutoGenerateColumns="false" |
| AllowPaging="true" AllowSorting="true" PageSize="50"> |
| <ClientSettings Scrolling-AllowScroll="true" Scrolling-UseStaticHeaders="true" /> |
| <MasterTableView DataKeyNames="ItemizedChargeTypeID, FacilityID, LoadBatchID"> |
| <Columns> |
| <rad:GridBoundColumn DataField="RV" Visible="false" ReadOnly="true" |
| ForceExtractValue="Always" /> |
| <rad:GridEditCommandColumn UniqueName="Edit" ItemStyle-HorizontalAlign="Center" |
| HeaderStyle-Width="50px" /> |
| <rad:GridBoundColumn DataField="ChargeCode" UniqueName="ChargeCode" |
| HeaderText="Charge Code" ReadOnly="true" ForceExtractValue="Always" |
| HeaderStyle-HorizontalAlign="Center" /> |
| <rad:GridBoundColumn DataField="Description" UniqueName="Description" |
| HeaderText="Description" ReadOnly="true" ForceExtractValue="Always" |
| HeaderStyle-HorizontalAlign="Center" /> |
| <rad:GridBoundColumn DataField="RevenueCode" UniqueName="RevenueCode" |
| HeaderText="Revenue Code" ForceExtractValue="Always" |
| HeaderStyle-HorizontalAlign="Center" /> |
| <rad:GridCheckBoxColumn DataField="Inferred" UniqueName="Inferred" |
| HeaderText="Inferred" ReadOnly="true" ForceExtractValue="Always" |
| ItemStyle-HorizontalAlign="Center" HeaderStyle-HorizontalAlign="Center" /> |
| <rad:GridCheckBoxColumn DataField="Active" UniqueName="Active" ReadOnly="true" |
| HeaderText="Active" ItemStyle-HorizontalAlign="Center" |
| HeaderStyle-HorizontalAlign="Center" /> |
| </Columns> |
| </MasterTableView> |
| </rad:RadGrid> |
| </div> <rad:RadAjaxManager runat="server"> <AjaxSettings> <rad:AjaxSetting AjaxControlID="itemizedChargeTypeGrid"> <UpdatedControls> <rad:AjaxUpdatedControl ControlID="itemizedChargeTypeGrid" LoadingPanelID="loadingPnl" /> </UpdatedControls> </rad:AjaxSetting> </AjaxSettings> </rad:RadAjaxManager> <rad:RadAjaxLoadingPanel ID="loadingPnl" runat="server" BackColor="White" MinDisplayTime="1000" Transparency="50" CssClass="loading" /> |
When the HTML above is rendered, the grid itself is wrapped in a div w/ an ID similar to <gridID>GridPanel or something similar. Upon inspection, this is due to my utilization of the RadAjaxManager (at least that's what I've concluded).
The RadAjaxManager itself doesn't expose any css related properties where I can specify the div that it renders to have a height of 100%. W/ a little jQuery, I tried something like:
$("#itemizedChargeTypeGrid").parent().css("height", "100%")
which stretched the parent container of the grid to be 100%; however, the data w/ in the grid itself still remained a fixed height. Upon reviewing the markup emitted by the RadGrid, I noticed the data was rendered in a div w/ an id similar to <gridID>_GridData. And so I thought, why not set the height of the class of that element to be 100%.
After doing so, the grid stretched; however, it appeared scrollbar functionality was lost. Forgive me for a long winded explanation, but ultimately my question is:
How can I get the grid to dynamically stretch vertically to fit the remainder of its parent container while retaining the ability to have records not immediately visible to be scrolled into view?
