Hello,
Doing a POC using https://www.infragistics.com/samples/aspnet/data-grid/add-new-row-server-events
I see that the row add event (RowAdding) is firing apart from using enter or tab keys (like click on another row and the add row event is fired after typing in the values in the new row) from the above link. The same functionality i did in my poc but the add row event is not firing after i click on another existing row.
However tab and enter keys are working for the RowAdding event.
How is that possible?
Vb.NET Code Behind:
grdDataTable.Behaviors.EditingCore.Enabled = True grdDataTable.Behaviors.EditingCore.EnableInheritance = True
With grdDataTable.Behaviors Dim gridBehavaior As GridBehavior = .EditingCore.Behaviors.CreateBehavior(Of RowAdding)() .EditingCore.Behaviors.Add(gridBehavaior) .EditingCore.Behaviors.RowAdding.Enabled = True .EditingCore.Behaviors.RowAdding.EnableInheritance = True .EditingCore.Behaviors.RowAdding.Alignment = AddNewRowAlignment.Bottom .EditingCore.Behaviors.RowAdding.EditModeActions.EnableOnActive = True .EditingCore.Behaviors.RowAdding.EditModeActions.MouseClick = EditMouseClickAction.Single
.aspx:
<asp:ScriptManager ID="ScriptManager1" runat="server"></asp:ScriptManager> <asp:UpdatePanel runat="server" ID="SampleUpdatePanel" ChildrenAsTriggers="true" UpdateMode="Conditional"> <ContentTemplate> <ig:WebExcelExporter ID="eExporter" runat="server"></ig:WebExcelExporter> <ig:WebDataGrid ID="grdDataTable" runat="server" AutoGenerateColumns="true" width="100%" ViewStateMode ="Enabled" EnableViewState ="true" EnableDataViewState="True" HeaderCaptionCssClass="WebDataGridColumnHeader" ItemCssClass = "WebDataGridRow" AltItemCssClass = "WebDataGridAlternating" OnColumnSorted="grdDataTable_SortColumn" OnPageIndexChanged="grdDataTable_PageIndexChanged" OnInitializeRow="grdDataTable_InitializeRow" OnRowAdding="grdDataTable_RowAdding" OnRowAdded="grdDataTable_RowAdded"> <Behaviors> <ig:Selection CellClickAction="Row" CellSelectType="Single" RowSelectType="Single" SelectedRowSelectorCssClass="DataGridSelectedRow" > </ig:Selection> <ig:Paging PagerAppearance="Bottom" PageSize="100" Enabled="true" /> <ig:Sorting SortingMode="Single" Enabled="true" /> <ig:ColumnResizing Enabled="false" /> <ig:Activation> </ig:Activation> <ig:EditingCore Enabled="false"> <Behaviors> <%--<ig:cellediting> <editmodeactions mouseclick="single" /> </ig:cellediting> --%> </Behaviors> </ig:EditingCore> </Behaviors> </ig:WebDataGrid> </ContentTemplate> </asp:UpdatePanel>
Hello Aravind,Thank you for the code-snippet and the sample reference you have provided.It seems that the question you are having is the same as the one on the following thread, to which I have already replied.For detailed information on this matter, you can take a look at the referenced thread.If you have any questions, please let me know.
Hi Tacho,
Yes that thread was started by my lead based on my question and I have created a separate logon to ask my questions. I did try that solution and it is not working. Even i removed the update panel and put EnableAjax = true, it still doesn't work.The WebDataGrid is part of a wrapper control which resides in a .ascx (User Control) and is being used by a web page(.aspx). Many web pages refer this .ascx wrapper user control to render the grid. The code behind of the user control binds the data to the grid dynamically. Let me attach the server side and user controls for your reference.
.Ascx->
<%@ Control Language="vb" AutoEventWireup="false" CodeBehind="WebDataGridControl.ascx.vb" Inherits="WebDataGridControl" %> <%@ Register Assembly="Infragistics45.Web.v17.2, Version=17.2.20172.2019, Culture=neutral, PublicKeyToken=7dd5c3163f2cd0cb" Namespace="Infragistics.Web.UI.GridControls" TagPrefix="ig" %> <script type="text/javascript"> $(document).ready(function () { //$find("grdDataTable")._callbackManager.setTimeout(6000000); }); </script> <asp:panel id="pnlModuleContent" style="PADDING-RIGHT: 0px; PADDING-LEFT: 0px; PADDING-BOTTOM: 0px; PADDING-TOP: 0px" runat="server" cssclass="WideModule"> <asp:ScriptManager ID="ScriptManager1" runat="server"></asp:ScriptManager> <asp:PlaceHolder id="plhFilterContents" Runat="server"></asp:PlaceHolder> <ig:WebExcelExporter ID="eExporter" runat="server"></ig:WebExcelExporter> <ig:WebDataGrid ID="grdDataTable" runat="server" AutoGenerateColumns="true" width="100%" ViewStateMode ="Enabled" EnableViewState ="true" EnableAjax="true" EnableDataViewState="True" HeaderCaptionCssClass="WebDataGridColumnHeader" ItemCssClass = "WebDataGridRow" AltItemCssClass = "WebDataGridAlternating" OnColumnSorted="grdDataTable_SortColumn" OnPageIndexChanged="grdDataTable_PageIndexChanged" OnInitializeRow="grdDataTable_InitializeRow" OnRowAdding="grdDataTable_RowAdding" OnRowAdded="grdDataTable_RowAdded"> <Behaviors> <ig:Selection CellClickAction="Row" CellSelectType="Single" RowSelectType="Single" SelectedRowSelectorCssClass="DataGridSelectedRow" > </ig:Selection> <ig:Paging PagerAppearance="Bottom" PageSize="100" Enabled="true" /> <ig:Sorting SortingMode="Single" Enabled="true" /> <ig:ColumnResizing Enabled="false" /> <ig:Activation> </ig:Activation> <ig:EditingCore Enabled="false"> <Behaviors> <%--<ig:cellediting> <editmodeactions mouseclick="single" /> </ig:cellediting> --%> </Behaviors> </ig:EditingCore> </Behaviors> </ig:WebDataGrid> <asp:datagrid id="dgHidden" visible="False" runat="server" autogeneratecolumns="True" headerstyle-cssclass="ListHead"></asp:datagrid> <INPUT id="hdnEditRow" type="hidden" value="-1" name="hdnEditRow" runat="server"> <asp:label id="lblApplicationError" visible="True" runat="server" cssclass="ErrorMessage" enableviewstate="false"></asp:label> <DIV align="left" style="vertical-align:middle"> <asp:label id="lblNoData" visible="False" runat="server" cssclass="normal">No data available.</asp:label> </DIV> </asp:panel>
-.ascx.vb->
Here the data is bound dynamically by passing in a datasource which can be a DataSet or a DataTable or a DateView
grdDataTable.DataSource = _dataSource grdDataTable.DataBind()
Thanks,
Aravind
To add , when I tested the code you attached to the thread I don't see the new add row. See screenshot below. I tried to place it in both top and bottom & I don't see it.
Hello Aravind,Thank you for the code-snippet and the screenshot you have provided.I have attached a sample application that uses both an UpdatePanel and a manual CRUD operation for adding the new row to the underlying DataTable by handling the RowAdding event. (An asp:Label gets updated when the event is fired.)The reason the add new row was missing from the screenshot you referred to is because the styles for the WebDataGrid are not present. I have included and referenced them in the current sample, which will automatically style the WebDataGrid.If you have any questions, please let me know.
WebDataGrid_sample(Modified)