Welcome Guest Search | Active Topics | Sign In | Register

Possible bug in grid or masked edit Options
Brad Coble
Posted: Friday, January 30, 2009 1:53:00 PM
Rank: Member
Groups: Member

Joined: 12/17/2008
Posts: 16
Hi!

Run this code and when it first appears, press the enter key. Then press the down arrow key. The cell will be filled with all 9s. It doesnt do it when you press up arrow just down arrow.

Thanks!!


Code: HTML/ASPX
<%@ Page Language="C#" %>
<%@ Import Namespace="System.Data" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<script runat="server">
    protected void Page_Load(object sender, EventArgs e)
    {
        DataSet ds = new DataSet("myds");
        ds.Tables.Add("row");
        ds.Tables["row"].Columns.Add("col1");
        ds.Tables["row"].Columns.Add("col2");
        ds.Tables["row"].Columns.Add("col3");

        for (int i = 1; i <= 29; i++)
        {
            DataRow newRow = ds.Tables["row"].NewRow();
            newRow["col1"] = "";
            newRow["col2"] = "";
            newRow["col3"] = "";
            ds.Tables["row"].Rows.Add(newRow);
        }

        Grid1.DataSource = ds;
        Grid1.DataBind();
    }
html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>

    <script type="text/javascript">
        function on_end_edit(cell) {
            var z = "me" + cell.getColIndex();
            var m = eo_GetObject(z);
            var v = m.getText();
            return v;
        }

        function on_begin_edit(cell) {
            var v = cell.getValue();
            var z = "me" + cell.getColIndex();
            var m = eo_GetObject(z);

            m.setText(v);

            m.setWidth(cell.getColumn().getWidth() - 8);
            
            var tb = document.getElementById(m.getId());


            window.setTimeout(
                function() {
                    tb.focus();
                }, 10);
        }

        function on_get_text(column, item, cellValue) {
            return cellValue;
        }

        function clientside_generic_handler(sender) {
        }

        function test_handler(sender) {
            
        }

        function pageLoad(sender, args) {
            var g = eo_GetObject("Grid1");
            g.selectCell(0, 0);
            g.focus();
        }
        
    </script>

</head>
<body>
    <form id="form1" runat="server">
    <div>
        <asp:ScriptManager ID="ScriptManager1" runat="server">
        </asp:ScriptManager>
        <eo:CallbackPanel ID="CallbackPanel1" runat="server" Triggers="{ControlID:Grid1;Parameter:}">
            <eo:Grid ID="Grid1" runat="server" BorderColor="#C7D1DF" BorderWidth="1px" ColumnHeaderAscImage="00050303"
                ColumnHeaderDescImage="00050304" ColumnHeaderDividerImage="00050302" Font-Bold="False"
                Font-Italic="False" Font-Names="Verdana" Font-Overline="False" Font-Size="9pt"
                Font-Strikeout="False" Font-Underline="False" GridLineColor="199, 209, 223" GridLines="Both"
                Height="690px" ItemHeight="23" Width="600px" FullRowMode="False" EnableKeyboardNavigation="True"
                DataTable="row" ClientSideOnCellSelected="clientside_generic_handler">
                <FooterStyle CssText="padding-bottom:4px;padding-left:4px;padding-right:4px;padding-top:4px;" />
                <ItemStyles>
                    <eo:GridItemStyleSet>
                        <ItemStyle CssText="background-color: white" />
                        <ItemHoverStyle CssText="background-image: url(00050206); background-repeat: repeat-x" />
                        <SelectedStyle CssText="background-image: url(00050207); background-repeat: repeat-x" />
                        <CellStyle CssText="padding-left:8px;padding-top:2px; color:#336699;white-space:nowrap;" />
                    </eo:GridItemStyleSet>
                </ItemStyles>
                <ContentPaneStyle CssText="text-align: left" />
                <Columns>
                    <eo:CustomColumn ClientSideGetText="on_get_text" ClientSideBeginEdit="on_begin_edit"
                        ClientSideEndEdit="on_end_edit" DataField="col1" HeaderText="Body Number" AllowResize="true">
                        <EditorTemplate>
                            <eo:MaskedEdit runat="server" ID="me0" Width="92" TextBoxStyle-CssText="BORDER-RIGHT: #7f9db9 1px solid; PADDING-RIGHT: 2px; BORDER-TOP: #7f9db9 1px solid; PADDING-LEFT: 2px; PADDING-BOTTOM: 1px; MARGIN: 0px; BORDER-LEFT: #7f9db9 1px solid; PADDING-TOP: 2px; BORDER-BOTTOM: #7f9db9 1px solid; font-family:Courier New;font-size:8pt;"
                                ClientSideOnLoad="test_handler">
                                <eo:MaskedEditSegment SegmentType="Number" Text="        " />
                            </eo:MaskedEdit>
                        </EditorTemplate>
                    </eo:CustomColumn>
                    <eo:CustomColumn ClientSideGetText="on_get_text" ClientSideBeginEdit="on_begin_edit"
                        ClientSideEndEdit="on_end_edit" DataField="col2" HeaderText="Robot Code" AllowResize="true">
                        <EditorTemplate>
                            <eo:MaskedEdit runat="server" ID="me1" Width="92" TextBoxStyle-CssText="BORDER-RIGHT: #7f9db9 1px solid; PADDING-RIGHT: 2px; BORDER-TOP: #7f9db9 1px solid; PADDING-LEFT: 2px; PADDING-BOTTOM: 1px; MARGIN: 0px; BORDER-LEFT: #7f9db9 1px solid; PADDING-TOP: 2px; BORDER-BOTTOM: #7f9db9 1px solid; font-family:Courier New;font-size:8pt;">
                                <eo:MaskedEditSegment SegmentType="Number" Text="        " />
                            </eo:MaskedEdit>
                        </EditorTemplate>
                    </eo:CustomColumn>
                    <eo:CustomColumn ClientSideGetText="on_get_text" ClientSideBeginEdit="on_begin_edit"
                        ClientSideEndEdit="on_end_edit" DataField="col3" HeaderText="Length" AllowResize="true">
                        <EditorTemplate>
                            <eo:MaskedEdit runat="server" ID="me2" Width="92" TextBoxStyle-CssText="BORDER-RIGHT: #7f9db9 1px solid; PADDING-RIGHT: 2px; BORDER-TOP: #7f9db9 1px solid; PADDING-LEFT: 2px; PADDING-BOTTOM: 1px; MARGIN: 0px; BORDER-LEFT: #7f9db9 1px solid; PADDING-TOP: 2px; BORDER-BOTTOM: #7f9db9 1px solid; font-family:Courier New;font-size:8pt;">
                                <eo:MaskedEditSegment SegmentType="Number" Text="        " />
                            </eo:MaskedEdit>
                        </EditorTemplate>
                    </eo:CustomColumn>
                </Columns>
                <ColumnHeaderStyle CssText="background-image:url('00050301');padding-left:8px;padding-top:2px;font-weight: bold;color:white;height:23px" />
            </eo:Grid>
        </eo:CallbackPanel>
    </div>
    </form>
</body>
</html>
eo_support
Posted: Friday, January 30, 2009 3:04:09 PM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,089
Hi,

The MaskedEdit does that because it has a numeric segment and by default, up arrow increases number value and down arrow decrease numeric value, when there is nothing there the decrease code regards it as decreasing from zero and wraps around. We understand there can cause significant confusion to end users, so we will see what we can do here. There is no guarantee though as it does have a purpose. :)

Thanks!
Brad Coble
Posted: Friday, January 30, 2009 3:07:28 PM
Rank: Member
Groups: Member

Joined: 12/17/2008
Posts: 16
That makes sense. I will consider other options for the segment.

Thanks!!


You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.