iSeller Commerce
iSeller POS Retail
iSeller POS F&B
iSeller POS Express
Crosslight
WebUI
ClientUI
What's New
Download Trial
Web Solution
Mobile Solution
Enterprise Solution
Custom Development
Blog
Community
Latest Development Blogs
ForumPostTopic
Browse By Tag
Hi
I found following text in WhitePaper:
How can I use multiple key field?
Regards
Michael
Did you handle your own delete and edit method using DeleteRow and UpdateRow server side method?
If you are not using strongly typed dataset to bind data to WebGrid, you will need to set some property to the datatable, such as primary key, allownull to pass the schema to the WebGrid .
In order to support multiple key field scenario you don't need to set the DataKeyField property in the WebGrid table. We already have a sample of this scenario in HierarchicalGrid.aspx. The OrderDetails has multiply key, OrderID and ProductID, so in the OrderDetails WebGrid definition no DataKeyField property is assigned
<ISWebGrid:WebGridTable Caption="Order Details" DataMember="Order Details">
On the other hand, the Order table which has the primary key OrderID will have to be assigned the DataKeyField property
<ISWebGrid:WebGridTable Caption="Orders" DataKeyField="OrderID" DataMember="Orders">
Hi Glenn
I have a table with 2 Foreignkey-Columns, which together define the Primarykey of this table.
The Columntypes are GUID. Small Batch Update is active.
On WebGrid1_PrepareDataBinding-Event I call RetrieveStructure().
If I add the following 2 Records, I get a Message from Website: The pending changes already contain a record with key ''
First Record:
00000000-0000-0000-0000-000000000001 and 10000000-0000-0000-0000-000000000000
Second Record:
00000000-0000-0000-0000-000000000002 and 10000000-0000-0000-0000-000000000000
On Debugmode I have seen, both columns are type of System.Guid and DataKeyField is not set.
How can I solve this problem?
How are you loading the data the gets bound to the grid? Because, in scenarios where we can bind a Dataset/DataTable in the InitializeDataSource event, we can just specify a composite primary key for the Datatable with those two columns and then the grid will consider both these columns as DataKeyFields.
I bound a DataSet on InitalizeDataSource-Event to WebGrid.
My test show WebGrid does have issue when adding new row with guid column key using BatchUpdate, However the issue is the key value of the guid is clipped so it will only get a few character of the guid not the whole guid. A bug report has been submitted to the developer.
Regarding the issue you are facing, the key is passed as '', after retrieving the dataset you will need to set some property to the datatable, such as primary key, allownull, unless you are already using strongly typed dataset to bind data to WebGrid.
I have a similar problem, i want to work in the webgrid a table with a composite primary key (id_user,id_role) and we only can define a key for the webgrid, what can i do?
what you mean with"specify a composite primary key for the datatable with those two columns" ????
Just quoting from my response earlier
In order to support multiple key field scenario you don't need toset the DataKeyField property in the WebGrid table. We already have a sample of this scenario in HierarchicalGrid.aspx. The OrderDetails has multiply key, OrderID and ProductID, so in the OrderDetails WebGrid definition no DataKeyField property is assigned <ISWebGrid:WebGridTable Caption="Order Details" DataMember="Order Details"> On the other hand, the Order table which has the primary key OrderID will have to be assigned the DataKeyField property<ISWebGrid:WebGridTable Caption="Orders" DataKeyField="OrderID" DataMember="Orders">
In order to support multiple key field scenario you don't need toset the DataKeyField property in the WebGrid table. We already have a sample of this scenario in HierarchicalGrid.aspx. The OrderDetails has multiply key, OrderID and ProductID, so in the OrderDetails WebGrid definition no DataKeyField property is assigned
Thanks for the answer, but in our interface user standar we don't use this kind of webgrid with child grid.
we have a user and we need to assign roles using the webgrid, but the problem is that we have two keys (id_user,id_role).
For add new rows we have the user like a default value and we can add the row without problems
But for edit and delete we have problems, because we have two keys and when we use tha buttoms grid, it shows an error
I use Multi primary key column, and enable batch update , it occurs the problem as above.I found this problem have not been solved at Intersoft Premier Studio 2014 R1 SP1,could you tell me the time when you would solved this problem?
I created a simple sample of WebGrid with the following detail:
I use Multi primary key column, and enable batch update , it occurs the problem as above.I found this problem have not been solved at Intersoft Premier Studio 2014 R1 SP1...
I was able to reproduce the above problem, The pending changes already contain a record with key '', when adding two records.
Could you please confirm whether you have similar scenario to my sample or not? If you have any additional information to add to this case, please feel free to let me know. I can provide my simple sample to be evaluated on your end if necessary.
Look forward to hearing back from you.
Could you please provide me your sample? Thank you very much!
I enclosed my sample as attachment. Please have the sample evaluated on your end and let me know the result.
Hello,Yudi
I ran your sample, when I add the first record, it ran normal, but when I add the second recode, it cause wrong. The attachment is my video about operation. Please have a look, and tell me why? Thank you very much!
Hi, Could you please help me solve the above problem? Thank you very much!
Hi Zhu hm,Your video is broken can you resend the video/ screenshot for the error?Best Regards,Arief
Hello,Arief Handany
The Attachment is my video, please have a look about it . Thank you very much!
Sorry for the delay in sending this.
I modified BatchUpdateGuidProblem sample so it now works with batch update feature (insert, update, and delete transactions).
For more detail, please take a look OnBatchUpdate server-side event in BatchUpdateGuidProblem.aspx.cs file.
Please let me know whether this helps or not.
or
Choose this if you're already a member of Intersoft Community Forum. You can link your OpenID account to your existing Intersoft Social ID.
Choose this if you don't have an Intersoft account yet. Your authenticated OpenID will be automatically linked to your new Intersoft account.
Enter your Wordpress Blogname