User Profile & Activity

Shawn August Member
Page
of 19
Posted: September 13, 2010 12:54 AM

Hello Shawn,

If you are using BatchUpdate scenario, all the changes should be indicated with flags or indicator.
E.g Delete with delete icon, which the row should be not bot removed from Grid until It accept the changes. It's already the behaviour.
If you want just remove the row from WebGrid instantly, you should not use BatchUpdate scenario.

Regards,
Handy

I do not understand what you are saying. After the Row.Delete method is called, I don't notice anything different in the UI. How does the user know the row is deleted? They indicated they do not want to see it anymore (hence deleted). Also, leaving it visible indicates updates to the fields are still allowed. 

 

We are using the BatchUpdate scenario for performance reasons. We want the user to be able to add/update/delete rows and then save when they choose to.  However, leaving a deleted row visible is confusing to them.  Is there a way to hide the row after the Delete method is called?

Posted: September 10, 2010 4:45 PM

TTT

Posted: September 9, 2010 5:22 PM

Hello,

After you delete a row, you will need to call grid.AcceptAllChanges(). With this way, all changes would be saved into your database. 

Regards,
Handy


I don't want to AcceptAllChanges. The user should be able to manipulate the grid including deleting rows which should remove them from the grid and put the appropriate data in the RowChanges collection until some event occurs. In this case, the trigger of a button.

 

Posted: September 9, 2010 12:56 PM

Hi Shawn,

I have attach a simple sample of creating a new rows using Javascript. Kindly advise me, is this the scenario you have been dealt with? If not

I have attach a video of my sample output.

Thank you and have a nice day.

Best regards,

Niven Prasetya

 

What's the difference between the AddPendingChanges method that I am using to add the row vs the Update that you are using?

 

I have the same problem.  Is the CategoryID field your PK? You are setting that in code when each new row is added. For me, the database will assign that record at the time the data is committed to the database. It seems that field needs to have a unique value. I do not want to set that field because it would indicate the record exists within the database when it does not yet.


TTT

Posted: September 9, 2010 12:55 PM

Hi Shawn,

Have you tried to use the code that I posted earlier? If yes and you still get the error, is it possible for you to send me a simple sample? so I could check and provide solution for the issue.

Thanks.

Best Regards,

Gordon Tumewu

 

It will work for the first one but not subsequent calls similiar to the original poster. The following error message is displayed: The pending changes already contain a record with key ''.  The problem goes away if I set the WebGrid's DataKeyField field to a unique value.  For new rows, this won't have a value in my scenario because the data is not committed to the database yet. 

What's the purpose of the SetChanges("false") method for the ProductID field? Why would the value of an apparent integer field be "false"?

 

TTT

Posted: September 9, 2010 12:54 PM

Hello,

When you delete a selected row, you would need to accept the pending changes.
If you don't accept pending changes, all modified changes, should be still persisted in WebGrid.

Regards,
Handy

 

I called the WebGridRow's AcceptChanges() method but it didn't work. Can you be specific on what I need to do?

Posted: September 8, 2010 10:59 AM

Hi Shawn,

I have attach a simple sample of creating a new rows using Javascript. Kindly advise me, is this the scenario you have been dealt with? If not

I have attach a video of my sample output.

Thank you and have a nice day.

Best regards,

Niven Prasetya

 

What's the difference between the AddPendingChanges method that I am using to add the row vs the Update that you are using?

 

I have the same problem.  Is the CategoryID field your PK? You are setting that in code when each new row is added. For me, the database will assign that record at the time the data is committed to the database. It seems that field needs to have a unique value. I do not want to set that field because it would indicate the record exists within the database when it does not yet.

Posted: September 7, 2010 3:24 PM

Hi Shawn,

Have you tried to use the code that I posted earlier? If yes and you still get the error, is it possible for you to send me a simple sample? so I could check and provide solution for the issue.

Thanks.

Best Regards,

Gordon Tumewu

 

It will work for the first one but not subsequent calls similiar to the original poster. The following error message is displayed: The pending changes already contain a record with key ''.  The problem goes away if I set the WebGrid's DataKeyField field to a unique value.  For new rows, this won't have a value in my scenario because the data is not committed to the database yet. 

What's the purpose of the SetChanges("false") method for the ProductID field? Why would the value of an apparent integer field be "false"?

Posted: September 7, 2010 9:21 AM

Hello Shawn,

I apologize for the previous post. It seems that a templatedcell can't handle an "Add" method.

I've misread your issue, which I was doing a different kind of issue.

If you like, you can add this into future request via TDN.

Once again, I apologize for the inconvenience.

Best regards,

Niven Prasetya

 

I don't understand what you mean by an "Add" method. I don't see one in the object model.

 

Basically, I am just trying to create new rows within a WebGrid using JavaScript. I should be able to default data and have it appear the same way as if it was binding on the server-side. Is that possible? If not, what is the work around?

 

Thank you.

Posted: September 3, 2010 1:46 PM

Hi Gordon

It's true, it's possible to add a single record.

But try to add more then one record. I get the Message The pending changes already contain a record with key ''.

Regards

Michael

 

I get the same error.

 

I have a button that just adds NewRows with default data. Fairly simple you would think.


There is no PK at that point as they are pending rows.

All times are GMT -5. The time now is 6:35 PM.
Previous Next