Ticket Q273639
Visible to All Users

ASPxGridView Row's Height

created 15 years ago

I have a grid with the following settings:
<Settings ShowVerticalScrollBar="true" VerticalScrollableHeight="500" UseFixedTableLayout="True" />
It works great but a page with less records which rows height is less than VerticalScrollableHeight doesn’t look good.
I would like to update the VerticalScrollableHeight in client side to Min(Grid’s Height , 500). I added an event to EndCallBack of the grid I can get the height by:
Var height = myGrid.getScrollableControl().style.height;
 but in order to calculate the necessaries height I need to know Each Rows hight. I know there are myGrid.pageRowCount rows in the page how can I browse all rows to add up their height? I hope that I am clear, and please let me know if there is a better solution.

Show previous comments (1)
?
Unknown 15 years ago

    Thank you Marion, but I couldn't use ASPxClientGridView.GetHeight could yo please provide an example on how & where to use it. Other thing e.Row.Height.Value in HtmRowCreated event is always 0. Is there any way t know the height of the row in Client or Server side? Thank you again. I really appreciate your services.

    DevExpress Support Team 15 years ago

      Hi Emmanuel,
      To get the row height on the server side, first you should set it, as was shown in my code snippet. If you don't want to do it, but want to get the default row height, let me suggest another solution. There are no public methods to get a grid row. However, you can put the <div> element into the DataItemTemplate and get it in the JavaScript function. For example:

      ASPx
      <dx:GridViewDataTextColumn FieldName="Description" VisibleIndex="3"> <DataItemTemplate> <div id="hr" style="height:100%"> <%#Eval("Description")%> </div> </DataItemTemplate> </dx:GridViewDataTextColumn>

      For the div height to be equal to the grid row one, set the div.style.height to 100 percentages. Therefore, you can easily get the row height:

      JavaScript
      alert(document.getElementById("hr").clientHeight);

      Please also take a look at the How to use the ASPxGridView control (with the enabled vertical scrollbar) in a Full Screen mode (100% browser Width and Height) example which may be helpful in your scenario.
      Thanks,
      Marion

      ?
      Unknown 15 years ago

        Thank you Marion. I will use the template with div. Thanks again and keep up the excellent work.

        Disclaimer: The information provided on DevExpress.com and affiliated web properties (including the DevExpress Support Center) is provided "as is" without warranty of any kind. Developer Express Inc disclaims all warranties, either express or implied, including the warranties of merchantability and fitness for a particular purpose. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.

        Confidential Information: Developer Express Inc does not wish to receive, will not act to procure, nor will it solicit, confidential or proprietary materials and information from you through the DevExpress Support Center or its web properties. Any and all materials or information divulged during chats, email communications, online discussions, Support Center tickets, or made available to Developer Express Inc in any manner will be deemed NOT to be confidential by Developer Express Inc. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.