Context menus appearing out of place

2 replies. Last post: February 4, 2011 5:58 AM by Martin Lie
Tags :
  • (None)
  • New Discussion
  • New Question
  • New Product Feedback
Adam ZeyMember
Hi,

We're having a problem where context menus appear out of place. First, here's some sample markup and the codebehind:

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="OwGrid.aspx.cs" Inherits="TestControls.OwGrid"%>
<%@ Register Assembly="ISNet.WebUI.WebGrid" Namespace="ISNet.WebUI.WebGrid" TagPrefix="ISNet" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head id="Head1" runat="server">
</head>
<body>
    <form id="form1" runat="server">
        <br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br />
        <IsNet:WebGrid ID="Gri1" runat="server" Width="100%" UseDefaultStyle="True" DefaultStyleMode="Elegant" OnInitializeDataSource="GridInitialize">
            <RootTable RowHeaders="Yes" RowHeightDefault="20px" Caption="New Title" TableHeaderVisible="true">
                <Columns>
                    <IsNet:WebGridColumn Name="ColA" DataMember="ColA" Caption="Column A"  />
                    <IsNet:WebGridColumn Name="ColB" DataMember="ColB" Caption="Column B"  />
                </Columns>
            </RootTable>
            <LayoutSettings AllowFilter="Yes" AllowGrouping="Yes" AllowEdit="Yes" AllowSorting="Yes" AllowColumnSizing="Yes" PagingMode="ClassicPaging"></LayoutSettings>
        </IsNet:WebGrid>
        <br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br />
    </form>
</body>
</html>

 using System;

using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using ISNet.WebUI.WebGrid;
namespace TestControls
{
    public partial class OwGrid : System.Web.UI.Page
    {
        protected void GridInitialize(object sender, DataSourceEventArgs e)
        {
            e.DataSource = new List<Foo>() { new Foo() { ColA = "1", ColB = "2" } };
        }
    }
    public class Foo
    {
        public string ColA { get; set; }
        public string ColB { get; set; }
    }
}

 


Originally, the problem we had was with the filter context menu appearing out of place. If you scroll down and click on the filter icon, the filter context menu appears farther down the page. We solved this by removing the "xmlns" from the HTML tag. However, the row context menus are still broken.

In IE6/7/8, if you scroll down, they appear on the page where they would have if you had not scrolled down the page; they're not taking the scroll location into consideration.

I found a temporary workaround by overriding the OnRowContextMenu function, and using the "IS.moz" code for IE:

x = event.clientX + document.body.scrollLeft + document.documentElement.scrollLeft;
y = event.clientY + document.body.scrollTop + document.documentElement.scrollTop;

However, this only fixes the problem for IE8. IE6 doesn't seem to support the scrollTop properties.

I'm using version 7.0.7200.401 of the grid. Is there a workaround for these issues that work on all browsers? Has this bug been fixed in newer versions of the grid?

All times are GMT -5. The time now is 8:06 PM.
Previous Next