Hi team,
I am working on Infragistic control migration and replacing Ultrawebgrid to Webdatagrid. I am implementing context menu by using Contextmenu client event of the grid on grid initialization like: grdMain.ClientEvents.ContextMenu = "DisplayContextMenu" and in client side DisplayContextMenu() trying to get the row data of the cell right clicked on. In ultrawebgrid we had method called igtbl_getCellById() that is not supporting in webdatagrid and replaced with $find(), it is not working. I want to row data on context menu click so that I can modify the correct row data. if row is not at all selected it is throwing exception. My grid looks like this:
<igtbl:WebDataGrid ID="grdMain" runat="server" OnInit="grdMain_Init" OnInitializeRow="grdMain_InitializeRow" OnPageIndexChanged="grdMain_PageIndexChanged" OnRowUpdating="grdMain_UpdateRowBatch" ClientIDMode="Static" OnRowsDeleting="grdMain_DeleteRowBatch" OnRowAdding="grdMain_AddNewRow" OnColumnSorted="grdMain_ColumnSorted" AutoGenerateColumns="false" DefaultColumnWidth="100px" EnableDataViewState="true">
<Behaviors>
<igtbl:Paging PagerAppearance="Bottom" PagerMode="NextPreviousFirstLast" PageSize="100" Enabled="true">
</igtbl:Paging>
<igtbl:RowSelectors Enabled="true" RowNumbering="false"/>
<igtbl:ColumnMoving Enabled="false"></igtbl:ColumnMoving>
<igtbl:Selection CellSelectType="Multiple" RowSelectType="Single" CellClickAction="Row" ColumnSelectType="Multiple" Enabled="true" />
<%--<igtbl:Selection CellSelectType="Single" CellClickAction="Cell">
</igtbl:Selection>--%>
<igtbl:Sorting Enabled="true" SortingMode="Multi">
<SortingClientEvents ColumnSorting="grdMain_Sorting_ColumnSorting" />
</igtbl:Sorting>
<igtbl:ColumnResizing Enabled="true"></igtbl:ColumnResizing>
<igtbl:Activation Enabled="true" >
<AutoPostBackFlags ActiveCellChanged="true" />
</igtbl:Activation>
<igtbl:ColumnFixing ShowLeftSeparator="true" AutoAdjustCells="true"></igtbl:ColumnFixing>
<igtbl:EditingCore BatchUpdating="true" AutoCRUD="false">
<igtbl:CellEditing Enabled="true" >
<EditModeActions EnableF2="true" MouseClick="Double" />
<CellEditingClientEvents/>
</igtbl:CellEditing>
<%-- <igtbl:RowAdding Enabled="false"></igtbl:RowAdding>
<igtbl:RowEditing Enabled="true" EnableDialog="true"></igtbl:RowEditing>--%>
<igtbl:RowDeleting Enabled="true" ShowDeleteButton="false"></igtbl:RowDeleting>
<igtbl:RowAdding Enabled="false"></igtbl:RowAdding>
</Behaviors>
</igtbl:EditingCore>
<Columns>
<igtbl:TemplateDataField Width="100px" Key="ShowDetail">
<ItemTemplate>
<asp:LinkButton runat="server" ID="MyLinkButton" Text="Detail" CausesValidation="false" Style="color: BLUE;" CommandName="Edit" OnClick="ShowChildDetails"
CommandArgument='<%# DataBinder.Eval(DirectCast(Container, Infragistics.Web.UI.TemplateContainer).Item, "Row.Index") %>' />
</ItemTemplate>
</igtbl:TemplateDataField>
</Columns>
<EmptyRowsTemplate>
<asp:Label ID="NoDataWarning" runat="server">No Data to Display</asp:Label>
</EmptyRowsTemplate>
</igtbl:WebDataGrid>
Please provide workaround for this. If we have replacement of igtbl_getCellById(cellid) that will be great.
Thanks,
Hello,
Use the args from the event to get the type of object that the context menu is shown for with args.get_type and args.get_item() will return the actual item. There are more details in the documentation for the ContextMenu Property.
Let me know if you have any questions with this matter.