﻿<?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 - OnkeyDown</title><link>http://www.intersoftsolutions.com/Community/Tags/OnkeyDown/</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>WebGrid freezing out OnKeyDown event after performing Replace Action.</title><link>http://www.intersoftsolutions.com/Community/Tags/OnkeyDown/</link><pubDate>Fri, 07 Sep 2012 08:14:24 GMT</pubDate><dc:creator>girishcs12</dc:creator><category>OnkeyDown</category><description>&lt;p /&gt;
&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p&gt;I am facing the typical problem, where i was requested to do Replace Operation. That is I need to delete the selected row and add new row to the grid based on any modification/change done to text(which is Column of grid (EventCode)). &lt;/p&gt;
&lt;p&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p&gt;I have successfully handled this problem and able to perform by pointing the selected object to the row just above selected row earlier and even it is showing from UI. But the real problem araised is Keyborad features is not working after this operation. &lt;/p&gt;
&lt;p&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p&gt;That is, Once i do this operation i am not able to use keyboard events (OnKeyDown) from Grid which is not working I need to manually use mouse to click on Grid Cell then Keyboard event fired able to move from up to down the Gridrows using arrowkeys.&lt;/p&gt;
&lt;p&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p&gt; Here, below is my code,&lt;/p&gt;
&lt;p&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p&gt;&amp;lt;ISWebGrid:WebGrid ID="TemplateGrid" runat="server" Width="100%" Height="90%" UseDefaultStyle="True"&lt;/p&gt;
&lt;p&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p&gt;            OnInitializeDataSource="TemplateGrid_InitializeDataSource" OnInitializeRow="TemplateGrid_InitializeRow"&lt;/p&gt;
&lt;p&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p&gt;            OnInitializeLayout="TemplateGrid_InitializeLayout" OnInitializeSelfReferenceDataSource="TemplateGrid_InitializeSelfReferenceDataSource"&amp;gt;&lt;/p&gt;
&lt;p&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p&gt;            &amp;lt;FlyPostBackSettings PostHiddenFields="True" PostViewState="False" /&amp;gt;&lt;/p&gt;
&lt;p&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p&gt;            &amp;lt;LayoutSettings CellPaddingDefault="0" CellSpacingDefault="0" VirtualPageSize="1000" AllowGrouping="No" AllowColumnMove="Yes" AllowSorting="Yes" GridLines="Vertical"&lt;/p&gt;
&lt;p&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p&gt;                AutoFitColumns="True" AutoHeight="False" AutoWidth="True" AllowFilter="No" StatusBarVisible="false"&amp;gt;&lt;/p&gt;
&lt;p&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p&gt;                   &amp;lt;ClientSideEvents  OnRowSelectorClick="ratTemplateTree.onGridCellClick" OnSelfRefRowExpand="ratTemplateTree.OnRowExpand" OnCellClick="ratTemplateTree.onGridCellClick"  OnRowSelect="ratTemplateTree.onGridRowSelect" OnBeforeDelete="ratTemplateTree.onGridBeforeDelete"&lt;/p&gt;
&lt;p&gt;                    OnKeyDown="ratTemplateGridUtility.autoSearchKeyDownHandler" OnAfterResponseProcess="ratTemplateTree.AfterResponseProcess;" OnBeforeRequest="ratTemplateTree.DoBeforeRequest" /&amp;gt;&lt;/p&gt;
&lt;p&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p&gt;            &amp;lt;/LayoutSettings&amp;gt;&lt;/p&gt;
&lt;p&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p&gt;            &amp;lt;RootTable DataKeyField="ITemplate" AllowColumnMove="Yes" AllowColumnSizing="Yes" AllowEdit="No" AllowSorting="Yes"&amp;gt;&lt;/p&gt;
&lt;p&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p&gt;                &amp;lt;Columns&amp;gt;&lt;/p&gt;
&lt;p&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p&gt;                    &amp;lt;ISWebGrid:WebGridColumn ShowInSelectColumns="No" ColumnType="CheckBox" AllowGrouping="No"&lt;/p&gt;
&lt;p&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p&gt;                        AllowSizing="No" AllowSorting="No" EditType="NoEdit" Name="ColumnCheckbox" Width="25px"&lt;/p&gt;
&lt;p&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p&gt;                        IsRowChecker="True" Bound="False"&amp;gt;&lt;/p&gt;
&lt;p&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p&gt;                    &amp;lt;/ISWebGrid:WebGridColumn&amp;gt;&lt;/p&gt;
&lt;p&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p&gt;                    &amp;lt;ISWebGrid:WebGridColumn Caption="Event Code" DataMember="EventCode" Name="EventCode"&lt;/p&gt;
&lt;p&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p&gt;                        ShowInSelectColumns="No" Width="100px" EditType="NoEdit" HiddenDataMember="HasError"&amp;gt;&lt;/p&gt;
&lt;p&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p&gt;                    &amp;lt;/ISWebGrid:WebGridColumn&amp;gt;&lt;/p&gt;
&lt;p&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p&gt;                    &amp;lt;ISWebGrid:WebGridColumn Caption="Narrative" DataMember="Narrative" Name="Narrative"&lt;/p&gt;
&lt;p&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p&gt;                        HiddenDataMember="ParentIndex" EditType="NoEdit" IsAutoWidth="true"&amp;gt;&lt;/p&gt;
&lt;p&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p&gt;                    &amp;lt;/ISWebGrid:WebGridColumn&amp;gt;&lt;/p&gt;
&lt;p&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p&gt;                    &amp;lt;ISWebGrid:WebGridColumn Caption="Parent Event" DataMember="parentCode" Name="parentCode" Width="100px"&amp;gt;&lt;/p&gt;
&lt;p&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p&gt;                    &amp;lt;/ISWebGrid:WebGridColumn&amp;gt;&lt;/p&gt;
&lt;p&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p&gt;                &amp;lt;/Columns&amp;gt;&lt;/p&gt;
&lt;p&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p&gt;                &amp;lt;SelfReferencingSettings ChildDataMember="ParentIndex" Enabled="True" ExpandColumnInnerTextPadding="10"&lt;/p&gt;
&lt;p&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p&gt;                    ExpandColumnMember="EventCode" LoadOnDemand="True" ParentDataMember="ITemplate"&lt;/p&gt;
&lt;p&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p&gt;                    ParentRootMode="NullValue" /&amp;gt;&lt;/p&gt;
&lt;p&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p&gt;            &amp;lt;/RootTable&amp;gt;&lt;/p&gt;
&lt;p&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p&gt;        &amp;lt;/ISWebGrid:WebGrid&amp;gt;&lt;/p&gt;
&lt;p&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p&gt;On the page .aspx i have added &amp;lt;asp:ScriptReference Path="~/Client_Resources/JavaScript/WebGridUtility.js" /&amp;gt; where the cliend side script of OnKeyDown="ratTemplateGridUtility.autoSearchKeyDownHandler" are written inside WebGridUtility.&lt;/p&gt;
&lt;p&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p&gt;And rest of Clientside events are written in &amp;lt;asp:ScriptReference Path="~/Client_Resources/JavaScript/pageScripts/TemplateTree.js" /&amp;gt; which is added inside the page only.&lt;/p&gt;
&lt;p&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p&gt;Please guide me how I am able to solve this Keyboard actions after performing the Replace operation on WebGrid. But this is performing good after addition, modification, deletion I am able to use keyboard arrow keys to navigate through the rows of Grid but once I do the Replace Operation Grid will refresh then it will be showing the row just above the replaced row but the keyboard arrow keys will be freezed completely. Then once again i need to use mouse click on any row on grid then keyboard arrows will start working normally :( .&lt;/p&gt;
&lt;p&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p&gt;So, please help me how to proceed further on this.&lt;/p&gt;
&lt;p&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p /&gt;</description></item></channel></rss>