Scrollable Grid Woes

Dino Esposito talks about another reason why building a Scrollable DataGrid isn't all it's cracked up to be. You would never think such a simple concept could be so complicated, and yet it is. That's HTML for ya. I'll have to have Andy check and see if ScrollingGrid suffers from the same problem. It sure is nice having someone work for you that's smarter than you are, don't let anyone ever tell you otherwise.

7 Comments

  • I can tell you that the ScrollingGrid does suffer this problem as well...

  • Unfortunately then, I don't think there is a way around it, especially since the rendering is all done server-side, and you'd have to intercept the DataBind event to find out how many items are being databound. Even in a client-side scenario, this would be less than ideal.



    Your best bet in this situation is to check the number of items in the grid, and set the EnableScrolling property to false, which will render a good old fashioned DataGrid without any fluff. You would have to esperiment with the number of rows to check for based on the design of your grid.

  • Unfortunately, thats what I was afraid of... :(

  • It's not entirely a bad thing though, because ScrollingGrid does have a way t handle it, it's just not 100% ideal. All you'd really need is an additional line that say something like:

    If DataSource.RowCount < 5 Then

    ScrollingGrid1.EnableScrolling = False

    End If

    ScrollingGrid1.DataBind()



    THis will render a standard DataGrid, which is really what you want in this situation anyways.

  • Actually 2 things, but still not a big deal. Perhaps you could add this to the code base.



    The part you mentioned needs to be implemented, but in addition, if EnableScrolling = false, then you also need to set ScrollingGrid1.Height = Unit.Empty. Without this, you encounter the same effect, except for no scrollbars.



    Perhaps this portion could be added to the code base.

  • The part that I mentioned is not implementation on our part. It has to be implemented in your code. Not everyone would expect ScrollingGrid to behave this way, so I can't force it on everyone. Basically, we can't do this because not all DataSources have a RowCount property, among other reasons.



    The second part we can definitely put in there. I'm releasing an update on Saturday, so it can make it in there by then. I'll have Andy check it out.

  • Sorry... I wasnt clear. What I meant to say was "The part you mentioned needs to be implemented by the client..."

Comments have been disabled for this content.