This is a migrated thread and some comments may be shown as answers.

[Solved] Preventing duplicate key values

3 Answers 104 Views
Grid
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Marc Simkin
Top achievements
Rank 2
Iron
Iron
Veteran
Marc Simkin asked on 10 Jul 2011, 04:35 PM

 

Hi:

If some of the columns in my grid are: Display Name, Order, Data Type, Required, etc.

I'm trying to figure out how to check the display name column when either a new row is about to be inserted or an existing row is edited to make sure that the value is not already present in any rows.

You can think of this as a unique constraint in SQL.

thanks

marc

3 Answers, 1 is accepted

Sort by
0
Rosen
Telerik team
answered on 11 Jul 2011, 07:18 AM
Hi Marc Simkin,

Although your requirement is not in the scope of your components, you may consider using remote validation or implement another custom validator in order to validate this.

Regards,
Rosen
the Telerik team

Register for the Q2 2011 What's New Webinar Week. Mark your calendar for the week starting July 18th and book your seat for a walk through of all the exciting stuff we will ship with the new release!

0
Marc Simkin
Top achievements
Rank 2
Iron
Iron
Veteran
answered on 11 Jul 2011, 10:20 AM
Is it possible to do this client side with the OnEdit or OnSave events?

I'm trying to figure out, how I can all the existing rows so thatI can loop through them to check for duplicate.

Using remote validation is expensive, since the data needs to be retrieved from the database.  There is now caching on the front end since there is more than one front end web server.

I origianlly wanted to use Batch Editing mode, however the pop up edit window is not supported in that mode.  As a result, I ended up with Ajax Editing mode.  Which will have perform issues, since for every insert/update, I'm going to the db, retrieving the existing data, making the change, and then saving back to the db.  Adding another set of round trips to the db, just to support remote validation doesn't make sense.

thanks

marc
0
Rosen
Telerik team
answered on 11 Jul 2011, 02:59 PM
Hello Marc Simkin,

I'm afraid that currently the data accessible through the grid's client object is only the current displayed page when the paging functionality is enabled. Therefore, checking only the available items will not yield correct results.
However, even if all items are present, there is always chance another user to have already changed the item making its value duplicated, the check will again yield incorrect result as it will be executed over an old data.

All the best,
Rosen
the Telerik team

Register for the Q2 2011 What's New Webinar Week. Mark your calendar for the week starting July 18th and book your seat for a walk through of all the exciting stuff we will ship with the new release!

Tags
Grid
Asked by
Marc Simkin
Top achievements
Rank 2
Iron
Iron
Veteran
Answers by
Rosen
Telerik team
Marc Simkin
Top achievements
Rank 2
Iron
Iron
Veteran
Share this question
or