Robert McLaws: FunWithCoding.NET

Public Shared Function BrainDump(ByVal dotNet As String) As [Value]

News

<script type="text/javascript"><!-- google_ad_client = "pub-4330602465258980"; google_hints = "ASP.NET, VB.NET, C#, C#.NET, WindowsForms, .NET Framework, VS2005, Visual Studio, XAML, WinFX, Windows Workflow, WPF, WCF, Atlas, NetFX3, Visual Studio Orcas"; google_ad_width = 120; google_ad_height = 240; google_ad_format = "120x240_as"; google_ad_type = "text_image"; google_ad_channel ="4997399242"; google_color_border = "B6C9E7"; google_color_bg = "EFEFEF"; google_color_link = "0000FF"; google_color_text = "000000"; google_color_url = "002C99"; //--></script> <script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"> </script>
<!--
-->

You should feel free to challenge me, disagree with me, or tell me I'm completely nuts in the comments section of each blog entry, but I reserve the right to delete any comment for any reason whatsoever. That said, I will most likely only delete abusive, profane, rude, or annonymous comments, so keep it polite, please.

Blogroll

Cool .NET Articles

My .NET Tools

My Builder.com Articles

My MSKB Articles

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.

Comments

Matt Berther said:

I can tell you that the ScrollingGrid does suffer this problem as well...
# January 8, 2004 9:35 AM

Robert McLaws said:

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.
# January 8, 2004 10:44 AM

Matt Berther said:

Unfortunately, thats what I was afraid of... :(
# January 8, 2004 12:08 PM

Robert McLaws said:

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.
# January 8, 2004 1:31 PM

Matt Berther said:

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.
# January 8, 2004 1:46 PM

Robert McLaws said:

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.
# January 8, 2004 1:50 PM

Matt Berther said:

Sorry... I wasnt clear. What I meant to say was "The part you mentioned needs to be implemented by the client..."
# January 8, 2004 2:30 PM