Possible Bug - Can't add/delete record if UseValueListForSorting=Yes (with grouped columns)

9 replies. Last post: October 15, 2009 2:58 AM by Michael Giger
Tags :

Hi

I have a table with 3 columns:

 - ID [GUID] autoincrement

 - LineID [GUID] foreignkey

 - ProductID [GUID] foreignkey

For columns LineID and ProductID I use ValueLists.

I set UseValueListForSorting = ValueListSorting.Yes because I want to sort by the DataTextField of Valuelist.

If the data are not grouped I can add or delete rows without problems.

But are the data grouped by LineID I get an errormessage like attached picture.

Regards

Michael

Answers

Hello Michael,

Thank you for pointing out the issue in this scenario.

We have been able to replicate your problem with the exact error message you reported, and will fix it in the upcoming hotfix.

The work item # is 431 for your tracking reference.

As an additional note for the complete solution, you'll need to clear the cached data source upon the data update process to avoid data-locking issue that may happen during the batch update process. This is only required if you're binding to datasource object through InitializeDataSource event.

For example,

protected void grdProductLine_BatchUpdate(object sender, BatchUpdateEventArgs e)
        {
            DataRowState rs = DataRowState.Added | DataRowState.Deleted;
            DataSet dsModified = ((DataSet)grdProductLine.GetCachedDataSource()).GetChanges(rs);
            if (dsModified != null)
            {
                PutDataMaintenanceProductLine(dsModified);
                grdProductLine.ClearCachedDataSource(); // clear data cache after update
            }
        }

Note: You'll need to apply the above codes _in addition_ to applying the upcoming hotfix.

 
Providing the most excellent technical support for Intersoft customers. Your satisfaction is our success.

All Replies

Based on the sample created using the scenario you describe, the issue could not be replicated. Feel free to modify the sample in order to replicate the sample. 


1 attachment

Hi Glenn

I send you Database-Backup (SQL Server 2008) file and my sample. I hope you can now replicate the issue.

After changing Connectionstring you should be able to run the sample and get the error like my last post.

In Event grdProductLine_PrepareDataBinding you can commenting out following line (samlpe run without error):

grdProductLine.RootTable.UseValueListForSorting = ValueListSorting.Yes;

Thanks for help!

Regards

Michael

We failed to open the Database you attach in the previous post. However, using the setting in the code we are able to replicate the issue in our environment. An issue report has been sent to our developer.

In order to solve this issue, we suggest to set the UseValueListForSorting property on the individual column that has WebValueList. For example in the first sample the code used:

grdObj.RootTable.Columns[1].UseValueListForSorting = ValueListSorting.Yes;
grdObj.RootTable.Columns[2].UseValueListForSorting = ValueListSorting.Yes;

Instead of:

grdObj.RootTable.UseValueListForSorting = ValueListSorting.Yes;

Now I set the property on the individual column (in PrepareDataBinding Event), but i get the same error message!

            WebGridColumn Dependencies = grd.RootTable.Columns[0];
            WebGridColumn ID = grd.RootTable.Columns[1];
            WebGridColumn ProductID = grd.RootTable.Columns[2];
            WebGridColumn AttributeID = grd.RootTable.Columns[3];
            WebGridColumn Setpoint = grd.RootTable.Columns[4];
            WebGridColumn Min = grd.RootTable.Columns[5];
            WebGridColumn Max = grd.RootTable.Columns[6];
            WebGridColumn FormatID = grd.RootTable.Columns[7];
            WebGridColumn ValueIndex = grd.RootTable.Columns[8];

            Dependencies.UseValueListForSorting = ValueListSorting.No;
            ID.UseValueListForSorting = ValueListSorting.No;
            ProductID.UseValueListForSorting = ValueListSorting.Yes;
            AttributeID.UseValueListForSorting = ValueListSorting.Yes;
            Setpoint.UseValueListForSorting = ValueListSorting.No;
            Min.UseValueListForSorting = ValueListSorting.No;
            Max.UseValueListForSorting = ValueListSorting.No;
            FormatID.UseValueListForSorting = ValueListSorting.Yes;
            ValueIndex.UseValueListForSorting = ValueListSorting.No;

It's interesting that the data is still inserted into the database!

Michael

James Member

Michael,

Make sure your column-level initialization codes are not inside !IsPostBack or other conditions. That means, those codes should always be executed during PrepareDataBinding.

Hope this helps,
James.

The code was always executed!

Thanks for tip.

Michael

Hello Michael,

Thank you for pointing out the issue in this scenario.

We have been able to replicate your problem with the exact error message you reported, and will fix it in the upcoming hotfix.

The work item # is 431 for your tracking reference.

 
Providing the most excellent technical support for Intersoft customers. Your satisfaction is our success.

Hello Michael,

Thank you for pointing out the issue in this scenario.

We have been able to replicate your problem with the exact error message you reported, and will fix it in the upcoming hotfix.

The work item # is 431 for your tracking reference.

As an additional note for the complete solution, you'll need to clear the cached data source upon the data update process to avoid data-locking issue that may happen during the batch update process. This is only required if you're binding to datasource object through InitializeDataSource event.

For example,

protected void grdProductLine_BatchUpdate(object sender, BatchUpdateEventArgs e)
        {
            DataRowState rs = DataRowState.Added | DataRowState.Deleted;
            DataSet dsModified = ((DataSet)grdProductLine.GetCachedDataSource()).GetChanges(rs);
            if (dsModified != null)
            {
                PutDataMaintenanceProductLine(dsModified);
                grdProductLine.ClearCachedDataSource(); // clear data cache after update
            }
        }

Note: You'll need to apply the above codes _in addition_ to applying the upcoming hotfix.

 
Providing the most excellent technical support for Intersoft customers. Your satisfaction is our success.

Thanks for the additional note.

I am very grateful for such advice!

All times are GMT -5. The time now is 4:51 PM.
Previous Next