Hi I am using Infragistics4 v11.2.
I am using a WebDataGrid, in which I have a couple of editable columns and a column with checkboxes. Rest of the columns are read only. For this I have used ObjectDatasource with paging and sorting enabled.
My requirement is that , when a button is clicked, on the server side button click event, I need to save the data entered in those two columns for all rows with the checkbox checked.
The issue I am facing is that when I edit the cells corresponding to those columns, It is trying calculate the updates and fire the update event. I am getting an exception "NotImplementedException: The method or operation is not implemented ".
Can anyone please tell me how to disable this auto CRUD. I dont want any update events to be fired. I tried <ig:EditingCore AutoCRUD="False"> , but no use.
Also, to fix the exception I tried defining a dummy update function. But it did not help.
Further, to the above description I am pasting the stack trace which I get:
NotImplementedException: The method or operation is not implemented.] Infragistics.Web.UI.Framework.Data.DataRecordPropertDescriptor.SetValue(Object component, Object value) +54 Infragistics.Web.UI.Framework.Data.<>c__DisplayClass1.<Update>b__0(Int32 affectedRecords, Exception exception) +384 System.Web.UI.DataSourceView.Update(IDictionary keys, IDictionary values, IDictionary oldValues, DataSourceViewOperationCallback callback) +143 Infragistics.Web.UI.Framework.Data.DataSourceControlAdapter.Update(Object dataItem, IDictionary keys, IDictionary values, IDictionary oldValues, DataSourceViewOperationCallback callback) +397 Infragistics.Web.UI.Framework.Data.DataSourceObjectView.Update(Object dataItem, IDictionary keys, IDictionary values, IDictionary oldValues, DataSourceViewOperationCallback callback) +62 Infragistics.Web.UI.GridControls.EditingCore.OnAction(String actionType, Object id, Object value, Object tag) +4803 Infragistics.Web.UI.GridControls.GridBehavior.Infragistics.Web.UI.GridControls.IGridBehavior.OnAction(String actionType, Object id, Object value, Object tag) +48 Infragistics.Web.UI.GridControls.GridBot.LoadAdditionalClientState(Object state) +1319 Infragistics.Web.UI.Framework.RunBot.HandleRaisePostDataChangedEvent() +204 Infragistics.Web.UI.GridControls.GridBot.HandleRaisePostDataChangedEvent() +73 Infragistics.Web.UI.Framework.Data.FlatDataBoundControl.RaisePostDataChangedEvent() +37 System.Web.UI.Page.RaiseChangedEvents() +134 System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +5201
Hello nancy1985,
When binding the WebDataGrid to an ObjectDataSource the data source has to be configured to support CRUD operations. I suggest that you implement insert, select, update and delete methods in your business object and change your ObjectDataSource accordingly. More information on the matter can be found here - http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.objectdatasource.aspx .
Please let me know if this helps.
Hi nancy1985,
If you can attach a sample reproducing the exception, I can take a look and see if it is somethign that can be fixed.
regards,David Young
Hi David Young,
Heres the code snippet:
WebdataGrid definition in the aspx page:
<ig:WebDataGrid ID="MyDataGrid" runat="server" Width="100%" DataKeyFields="MyID" EnableDataViewState="True" AutoGenerateColumns="False" OnInitializeRow="BindHyperLink"> <Columns>
<ig:BoundCheckBoxField DataFieldName="rowSelected" CssClass="Center" Key="rowSelected" Width="30px" Header-CssClass="Center">
<Header CssClass="Center" />
</ig:BoundCheckBoxField>
<ig:TemplateDataField Key="quantity">
<ItemTemplate>
<ig:WebTextEditor ID="QuantityEditor" runat="server" Width="50px">
</ig:WebTextEditor>
</ItemTemplate>
<Header Text="Quantity*" />
</ig:TemplateDataField>
<ig:TemplateDataField Key="type">
<ig:WebDropDown ID="typeDropDownID" runat="server" DropDownItemBinding-ValueField="ID" CurrentValue="--- Select ---" DropDownItemBinding-TextField="Name" TextField="Name" ValueField="ID">
</ig:WebDropDown>
<Header Text="Type*" />
<ig:BoundDataField DataFieldName="MyID" Key="MyID" CssClass="">
<Header Text="My ID" CssClass="Center" />
</ig:BoundDataField>
<ig:BoundDataField DataFieldName="Name" Key="Name">
<Header Text="Name" />
</Columns>
<Behaviors>
<ig:EditingCore AutoCRUD="False">
<ig:CellEditing>
<ColumnSettings>
<ig:EditingColumnSetting ColumnKey="MyID" ReadOnly="True" />
<ig:EditingColumnSetting ColumnKey="Name" ReadOnly="True" />
</ColumnSettings>
<CellEditingClientEvents ExitedEditMode="updateCheckBoxWithQuantity" />
<EditModeActions MouseClick="Single" />
</ig:CellEditing>
</Behaviors>
</ig:EditingCore>
<ig:RowSelectors>
</ig:RowSelectors>
<ig:Selection RowSelectType="Single" CellClickAction="Row">
</ig:Selection>
<ig:Paging PageSize="8" PagerMode="NumericFirstLast">
</ig:Paging>
<ig:Sorting SortingMode="Single">
<ig:SortingColumnSetting ColumnKey="rowSelected" Sortable="False" />
<ig:SortingColumnSetting ColumnKey="quantity" Sortable="False" />
<ig:SortingColumnSetting ColumnKey="type" Sortable="False" />
</ig:Sorting>
<ig:ColumnResizing>
</ig:ColumnResizing>
<ig:ColumnMoving>
</ig:ColumnMoving>
<ig:Activation>
</ig:Activation>
<EmptyRowsTemplate>
No results found for the given criteria
</EmptyRowsTemplate>
</ig:WebDataGrid>
In the code behind, on page load, I call this function to bind the grid to ObjectDataSource:
public void bindDataToGrid()
{
ObjectDataSource objectDataSource = new ObjectDataSource();
objectDataSource.ID = "ObjSrc";
objectDataSource.SelectMethod = "getObjDS";
objectDataSource.TypeName = "MyApp.App_Code.DAL.DAL";
objectDataSource.DataObjectTypeName = "MyApp.App_Code.DAL.DALBO";
objectDataSource.UpdateMethod = "update";
objectDataSource.DeleteMethod = "delete";
objectDataSource.InsertMethod = "insert";
objectDataSource.SortParameterName = "sortExp";
objectDataSource.EnablePaging = true;
objectDataSource.StartRowIndexParameterName = "StartRecord";
objectDataSource.MaximumRowsParameterName = "PageSize";
objectDataSource.SelectCountMethod = "getCount";
objectDataSource.EnableCaching = false;
Parameter whereClauseParameter = new Parameter();
whereClauseParameter.Name = "whereClause";
whereClauseParameter.Type = TypeCode.String;
whereClauseParameter.DefaultValue = whereClause; //This is the where clause constructed based on the data entered in other UI fields
objectDataSource.SelectParameters.Add(whereClauseParameter);
MyDataGrid.DataSource = objectDataSource;
MyDataGrid.DataBind();
MyDataGrid.Visible = true;
}
Insert/Update/Delete/Select methods in the BO:
public void insert(MyBO view)
System.Diagnostics.Debug.WriteLine("Inside insert ");
public void delete(MyBO view)
System.Diagnostics.Debug.WriteLine("Inside delete ");
public void update(MyBO view)
System.Diagnostics.Debug.WriteLine("Inside update ");
public List<MyBO> getObjDS(String whereClause, string sortExp, int PageSize, int StartRecord)
//logic to get the rows from the corresponding table based on the input parameters, populate the list of BO and return the list.
public int getCount(String whereClause) {
int count = 0;
//Logic to get the count
return count;
Kindly help me with this.
I have been looking through the code you have provided, but it seems to be correct. In order to be able to investigate this issue further, I would need a small isolated sample, demonstrating the behavior you have described.
Please let me know if you have any other questions.
I'm glad you solved your issue.
Let me know if you have any other questions.
Hi Nikolay,
Thanks for the response.
I tried out a different approach for this. I defined the ObjectDataSource in my aspx page itself. After that I am not getting this exception.
Please let me know if you have any further questions.