WebGrid freezing out OnKeyDown event after performing Replace Action.

5 replies. Last post: September 12, 2012 10:39 PM by Handy Surya
Tags :
  • New Discussion
  • New Question
  • New Product Feedback
Girish GMember

Hi,


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)). 


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. 


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.


 Here, below is my code,



<ISWebGrid:WebGrid ID="TemplateGrid" runat="server" Width="100%" Height="90%" UseDefaultStyle="True"


            OnInitializeDataSource="TemplateGrid_InitializeDataSource" OnInitializeRow="TemplateGrid_InitializeRow"


            OnInitializeLayout="TemplateGrid_InitializeLayout" OnInitializeSelfReferenceDataSource="TemplateGrid_InitializeSelfReferenceDataSource">


            <FlyPostBackSettings PostHiddenFields="True" PostViewState="False" />


            <LayoutSettings CellPaddingDefault="0" CellSpacingDefault="0" VirtualPageSize="1000" AllowGrouping="No" AllowColumnMove="Yes" AllowSorting="Yes" GridLines="Vertical"


                AutoFitColumns="True" AutoHeight="False" AutoWidth="True" AllowFilter="No" StatusBarVisible="false">


                   <ClientSideEvents  OnRowSelectorClick="ratTemplateTree.onGridCellClick" OnSelfRefRowExpand="ratTemplateTree.OnRowExpand" OnCellClick="ratTemplateTree.onGridCellClick"  OnRowSelect="ratTemplateTree.onGridRowSelect" OnBeforeDelete="ratTemplateTree.onGridBeforeDelete"

                    OnKeyDown="ratTemplateGridUtility.autoSearchKeyDownHandler" OnAfterResponseProcess="ratTemplateTree.AfterResponseProcess;" OnBeforeRequest="ratTemplateTree.DoBeforeRequest" />


            </LayoutSettings>


            <RootTable DataKeyField="ITemplate" AllowColumnMove="Yes" AllowColumnSizing="Yes" AllowEdit="No" AllowSorting="Yes">


                <Columns>


                    <ISWebGrid:WebGridColumn ShowInSelectColumns="No" ColumnType="CheckBox" AllowGrouping="No"


                        AllowSizing="No" AllowSorting="No" EditType="NoEdit" Name="ColumnCheckbox" Width="25px"


                        IsRowChecker="True" Bound="False">


                    </ISWebGrid:WebGridColumn>


                    <ISWebGrid:WebGridColumn Caption="Event Code" DataMember="EventCode" Name="EventCode"


                        ShowInSelectColumns="No" Width="100px" EditType="NoEdit" HiddenDataMember="HasError">


                    </ISWebGrid:WebGridColumn>


                    <ISWebGrid:WebGridColumn Caption="Narrative" DataMember="Narrative" Name="Narrative"


                        HiddenDataMember="ParentIndex" EditType="NoEdit" IsAutoWidth="true">


                    </ISWebGrid:WebGridColumn>


                    <ISWebGrid:WebGridColumn Caption="Parent Event" DataMember="parentCode" Name="parentCode" Width="100px">


                    </ISWebGrid:WebGridColumn>


                </Columns>


                <SelfReferencingSettings ChildDataMember="ParentIndex" Enabled="True" ExpandColumnInnerTextPadding="10"


                    ExpandColumnMember="EventCode" LoadOnDemand="True" ParentDataMember="ITemplate"


                    ParentRootMode="NullValue" />


            </RootTable>


        </ISWebGrid:WebGrid>


On the page .aspx i have added <asp:ScriptReference Path="~/Client_Resources/JavaScript/WebGridUtility.js" /> where the cliend side script of OnKeyDown="ratTemplateGridUtility.autoSearchKeyDownHandler" are written inside WebGridUtility.


And rest of Clientside events are written in <asp:ScriptReference Path="~/Client_Resources/JavaScript/pageScripts/TemplateTree.js" /> which is added inside the page only.


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 :( .


So, please help me how to proceed further on this.




All times are GMT -5. The time now is 2:04 PM.
Previous Next