﻿<?xml version="1.0" encoding="utf-8"?><rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:sy="http://purl.org/rss/1.0/modules/syndication/" xmlns:media="http://search.yahoo.com/mrss/" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" version="2.0"><channel><title>Intersoft Community - WebGrid Enterprise - Enter_Event issue</title><link>http://www.intersoftsolutions.com/Community/WebGrid/EnterEvent-issue/</link><description /><generator>http://www.intersoftsolutions.com</generator><language>en</language><copyright>Copyright 2002 - 2015 Intersoft Solutions Corp. All rights reserved.</copyright><ttl>60</ttl><item><title>Enter_Event issue</title><link>http://www.intersoftsolutions.com/Community/WebGrid/EnterEvent-issue/</link><pubDate>Wed, 13 Oct 2010 01:33:43 GMT</pubDate><dc:creator>qq397472251</dc:creator><category>WebGrid</category><category>Event</category><category>NoEdit</category><category>enter</category><description>&lt;p&gt;Thank you,&lt;span class="postusername"&gt;&lt;a class="contentlink" href="http://www.intersoftpt.com/Community/Users/Glayaar/"&gt;Glenn Layaar&lt;/a&gt;.T&lt;/span&gt;he problem has solved. &lt;/p&gt;
&lt;p&gt;I was mistaken that "Get first cell" by "grid.RootTable.GetRow(curRow).GetCell(1);" in the past.&lt;br /&gt;Now I chang a little code ,it work perfect ：&lt;/p&gt;&lt;pre&gt;function wgTest_OnKeyDown(controlId, tblName, rowIndex, cellIndex) {
            var grid = ISGetObject(controlId);
            var totalRows = grid.TotalRows;
            var curRow = grid.GetSelectedObject().rowIndex;
            var curCell = grid.GetActiveEditCell().cellIndex-1;
            var activeCell = grid.GetActiveEditCell();

            if (activeCell.rowElement.type == "Record") {

                if (event.keyCode == 13) {

                    if (curCell == grid.RootTable.Columns.length-1) {                        
                        grid.SetFocus();
                        grid.RootTable.GetRow(curRow &amp;#43; 1).Select();
                        var nextCell1 = grid.RootTable.GetRow(curRow &amp;#43; 1).GetCell(0);
                        nextCell1.ActivateEdit();
                    }
                    else {
                        grid.SetFocus();
                        grid.RootTable.GetRow(curRow).Select();
                        var nextCell = grid.RootTable.GetRow(curRow).GetCell(curCell&amp;#43;1);
                        nextCell.ActivateEdit();
                    }
                }
                return true;
            }
        }&lt;/pre&gt;
</description></item><item><title>Enter_Event issue</title><link>http://www.intersoftsolutions.com/Community/WebGrid/EnterEvent-issue/</link><pubDate>Thu, 07 Oct 2010 23:55:47 GMT</pubDate><dc:creator>Glayaar</dc:creator><category>WebGrid</category><category>Event</category><category>NoEdit</category><category>enter</category><description>&lt;p&gt;Using a simplified snippet with only the enter key conditional I have no such issue on my test page in my environment. Attached is the test page I am using, you will need to have northwind.mdb which is available from the provided Intersoft WebGrid sample.&lt;/p&gt;&lt;p&gt;I am also using the latest WebGrid 7 and WebUI Framework 3, build 404 and 755 respectively.&lt;br /&gt;&lt;/p&gt;</description></item><item><title>Enter_Event issue</title><link>http://www.intersoftsolutions.com/Community/WebGrid/EnterEvent-issue/</link><pubDate>Thu, 07 Oct 2010 21:39:07 GMT</pubDate><dc:creator>qq397472251</dc:creator><category>WebGrid</category><category>Event</category><category>NoEdit</category><category>enter</category><description>&lt;p&gt; Webgrid  have a column which is &lt;strong&gt;"NoEdit"&lt;/strong&gt; !&lt;/p&gt;&lt;pre&gt; &amp;lt;ISWebGrid:WebGridColumn Width="60px" EditType="NoEdit" Name="idxBox" Caption="myname" &amp;gt;    
  &amp;lt;/ISWebGrid:WebGridColumn&amp;gt;&lt;/pre&gt;
&lt;p&gt;When focus on  "myname"  column, I Press&lt;strong&gt; Enter Key&lt;/strong&gt;,can not tun into next cell ！&lt;br /&gt;&lt;span style="color: #c00000"&gt;How can I do to tun into next cell&amp;nbsp; when have a &lt;strong&gt;"NoEdit"&lt;/strong&gt;&amp;nbsp; column???&lt;pre&gt;&lt;span style="color: #0c0c0c"&gt;function WebGrid1_OnEditKeyDown(controlId, tblName, rowIndex, cellIndex) {
    var grid = ISGetObject(controlId);
    var totalRows = grid.TotalRows;
    var curRow = grid.GetSelectedObject().rowIndex;
    var curCell = grid.GetActiveEditCell().cellIndex;
    var activeCell = grid.GetActiveEditCell();

    if (activeCell.rowElement.type == "Record") {
        if (event.keyCode == 37)//左键左移
        {
            if (curCell != 1)//不是第一单元,则在该行左移
            {
                MoveAndSelectCell(curRow, curCell - 2);
            } else//如果是第一单元并且不是第一行则上移一行
            {
                if (curRow != 0) {
                    MoveAndSelectCell(curRow - 1, 3);
                }
            }
        }

        if (event.keyCode == 39)//右键右移
        {
            if (curCell != 8)//不是最后单元则在该行移
            {
                MoveAndSelectCell(curRow, curCell);
            } else {
                if (curRow != (totalRows - 1))//不是最后一行,则下移一行.
                {
                    MoveAndSelectCell(curRow &amp;#43; 1, 1);
                }
            }
        }

        if (event.keyCode == 38)//下键上移
        {
        alert('up');
        }
        if (event.keyCode == 40)//下键下移
        {
     
            
            if (curRow &amp;lt; (totalRows - 1))//如果不是最后一行，则下移一行
            {
//                if (curCell != 4) {
//                MoveAndSelectCell(curRow &amp;#43; 1, curCell-1);
//             
//                                     
//                } else {
//                    var WebCombo1 = ISGetObject("WebCombo1");
//                    window.setTimeout(function() { WebCombo1.ShowDropDown(true); }, 100);
//                }
            }
        }

        if (event.keyCode == 13)//如果是回车
        {
            if (curCell == 8) {

                if (curRow == (totalRows - 1)) {
                       
                        var newRow = grid.RootTable.NewRow();
                        var newCells = newRow.GetCells();

                        newCells.GetNamedItem("vouid").SetText(totalRows &amp;#43; 1, true);
                        newCells.GetNamedItem("商品编号").SetText("", true);
                        newCells.GetNamedItem("商品名称").SetText("", true);
                        newCells.GetNamedItem("商品规格").SetText("", true);
                        newCells.GetNamedItem("包装单位").SetText("", true);
                        newCells.GetNamedItem("数量").SetText("", true);
                        newCells.GetNamedItem("价格范围").SetText("", true);
                        newCells.GetNamedItem("备注").SetText("", true);

                  
                        
                        
                        newRow.Update();
                      
                        
                        window.setTimeout(function() { SelectNextRow(curRow &amp;#43; 1); }, 1000);     
                }
                else {
                    var nextCell = grid.RootTable.GetRow(curRow &amp;#43; 1).GetCell(1);
                    grid.SetFocus();
                    grid.RootTable.GetRow(curRow &amp;#43; 1).Select();
                    nextCell.ActivateEdit();
                }
                event.keyCode = null;
            } else {
                event.keyCode = 9;
            }
        }
    }
    return true;
}&lt;/span&gt;&lt;/pre&gt;&lt;/span&gt;&lt;/p&gt;&lt;pre&gt;&lt;span style="color: #0c0c0c"&gt;function WebGrid1_OnEditKeyDown(controlId, tblName, rowIndex, cellIndex) {
    var grid = ISGetObject(controlId);
    var totalRows = grid.TotalRows;
    var curRow = grid.GetSelectedObject().rowIndex;
    var curCell = grid.GetActiveEditCell().cellIndex;
    var activeCell = grid.GetActiveEditCell();

    if (activeCell.rowElement.type == "Record") {
        if (event.keyCode == 37)//左键左移
        {
            if (curCell != 1)//不是第一单元,则在该行左移
            {
                MoveAndSelectCell(curRow, curCell - 2);
            } else//如果是第一单元并且不是第一行则上移一行
            {
                if (curRow != 0) {
                    MoveAndSelectCell(curRow - 1, 3);
                }
            }
        }

        if (event.keyCode == 39)//右键右移
        {
            if (curCell != 8)//不是最后单元则在该行移
            {
                MoveAndSelectCell(curRow, curCell);
            } else {
                if (curRow != (totalRows - 1))//不是最后一行,则下移一行.
                {
                    MoveAndSelectCell(curRow &amp;#43; 1, 1);
                }
            }
        }

        if (event.keyCode == 38)//下键上移
        {
        alert('up');
        }
        if (event.keyCode == 40)//下键下移
        {
     
            
            if (curRow &amp;lt; (totalRows - 1))//如果不是最后一行，则下移一行
            {
//                if (curCell != 4) {
//                MoveAndSelectCell(curRow &amp;#43; 1, curCell-1);
//             
//                                     
//                } else {
//                    var WebCombo1 = ISGetObject("WebCombo1");
//                    window.setTimeout(function() { WebCombo1.ShowDropDown(true); }, 100);
//                }
            }
        }

        if (event.keyCode == 13)//如果是回车
        {
            if (curCell == 8) {

                if (curRow == (totalRows - 1)) {
                       
                        var newRow = grid.RootTable.NewRow();
                        var newCells = newRow.GetCells();

                        newCells.GetNamedItem("vouid").SetText(totalRows &amp;#43; 1, true);
                        newCells.GetNamedItem("商品编号").SetText("", true);
                        newCells.GetNamedItem("商品名称").SetText("", true);
                        newCells.GetNamedItem("商品规格").SetText("", true);
                        newCells.GetNamedItem("包装单位").SetText("", true);
                        newCells.GetNamedItem("数量").SetText("", true);
                        newCells.GetNamedItem("价格范围").SetText("", true);
                        newCells.GetNamedItem("备注").SetText("", true);

                  
                        
                        
                        newRow.Update();
                      
                        
                        window.setTimeout(function() { SelectNextRow(curRow &amp;#43; 1); }, 1000);     
                }
                else {
                    var nextCell = grid.RootTable.GetRow(curRow &amp;#43; 1).GetCell(1);
                    grid.SetFocus();
                    grid.RootTable.GetRow(curRow &amp;#43; 1).Select();
                    nextCell.ActivateEdit();
                }
                event.keyCode = null;
            } else {
                event.keyCode = 9;
            }
        }
    }
    return true;
}&lt;/span&gt;&lt;/pre&gt;
</description></item></channel></rss>