English 中文(简体)
How to turn on line number tooltip while scrolling infragistics ultrawebgrid
原标题:

I once saw this feature in action but I don t know how to turn it on. The grid can show a tooltip with the current row number (or row ID) while dragging the scrollbar. This helps you to stop the scroll in the right place. I m assuming some property will turn this on, but I can t find it. Maybe it is also dependent on the scroll mode?

UPDATE: In the image below you can see an example of the tooltip I m looking for. This is displayed while the scrollbar is being dragged (up or down). The number in the tooltip is the row number (you can t see it in this image, way to the left in the grid). This is the same grid that I am using now. Just from a very old build of our product. Somehow this tooltip was turned off. And no one knows how to turn it back on :( I m pretty sure this is a built in feature of the ultrawebgrid. Not something that required extra coding.

alt text http://img138.imageshack.us/img138/6337/croppercapture.jpg

最佳回答

Right! Now that we ve established that you have version 6.3, I ve hopefully got a solution for you. I don t have 6.3 myself, but I ve got a slightly later one that I think didn t have Virtual Scrolling added as a feature yet.

So try this code:

webgrid.DisplayLayout.XmlLoadOnDemandType = XmlLoadOnDemandType.Virtual;

This should automatically put a tooltip on the grid as you scroll down. Have a look here for a running sample... (and remember to choose the virtual option)

Here s hoping!

Rob G

问题回答

I don t know if there s a UltraWebGrid property to simply turn on the behavior you re looking for. I almost suspect you experienced this feature in another application, perhaps not even a web based one (sorry!). I do however, know exactly what you re talking about.

As a work-around, I would suggest allowing the user to input the destination row number, and to simply "jump" to it, using this technique.

If that doesn t satisfy you, it may be possible to achieve this behavior with JavaScript. You would need to use something like this technique to get the information you need, estimate (or actually detect, if possible) the row number, and the rest is up to the GUI. I would go with the work-around described above though :)

I m typing this from memory here as I don t have it installed on this machine and I haven t seen that setting before, but how about adding something like this to the InitializeRow event:

foreach (UltraGridCell cell in e.Row.Cells)
{
    if(cell.Column.Key == "Topic") //from your grid above
       cell.Title = cell.Row.Index;
}

The row object itself does not have a "Title" property from memory, but the cell does.

See if that works...

Regards,
Rob G

OK - I think I ve found your illusive setting:

You can set the TipStyleScroll on the Override to Show on the Grid (this may be version dependant).

You can determine which field is displayed as the tooltip by using the ScrollTipField property of the band.

I did it like so:

        myGrid.DisplayLayout.Override.TipStyleScroll = TipStyle.Show;
        myTopBand.ScrollTipField = "Id";

...and it works like a charm!

If it s a really long list, sometimes setting the ScrollStyle to Deferred helps:

        myGrid.DisplayLayout.ScrollStyle = ScrollStyle.Deferred;

Hope that helps...

Rob G

Once again - not sure which version you have, so to be safe here s somthing you can try from 2009 version:

myGrid.Behaviors.VirtualScrolling.Enabled = true;
myGrid.Behaviors.VirtualScrolling.TooltipVisibility = DefaultableBoolean.True;

If your scrolling mode is Deferred instead of Virtual, then the tooltip is normally enabled by default.

You can find full details about this feature here

Hope that helps,

Rob G





相关问题
Anyone feel like passing it forward?

I m the only developer in my company, and am getting along well as an autodidact, but I know I m missing out on the education one gets from working with and having code reviewed by more senior devs. ...

How to Add script codes before the </body> tag ASP.NET

Heres the problem, In Masterpage, the google analytics code were pasted before the end of body tag. In ASPX page, I need to generate a script (google addItem tracker) using codebehind ClientScript ...

Transaction handling with TransactionScope

I am implementing Transaction using TransactionScope with the help this MSDN article http://msdn.microsoft.com/en-us/library/system.transactions.transactionscope.aspx I just want to confirm that is ...

System.Web.Mvc.Controller Initialize

i have the following base controller... public class BaseController : Controller { protected override void Initialize(System.Web.Routing.RequestContext requestContext) { if (...

Microsoft.Contracts namespace

For what it is necessary Microsoft.Contracts namespace in asp.net? I mean, in what cases I could write using Microsoft.Contracts;?

Separator line in ASP.NET

I d like to add a simple separator line in an aspx web form. Does anyone know how? It sounds easy enough, but still I can t manage to find how to do it.. 10x!

热门标签