fill textboxControl in custom table from another custom table

Reza sh asked on November 15, 2015 18:17

hi. i made two table in custom table page. in tables are many field. but i want , when i choose a customer number, another field such as name, fammily , mobile number, will fill automatically. how can i write a join query in custom tables queries? please take an example.

Recent Answers

David te Kloese answered on November 16, 2015 01:14


So you want one record in your custom table to refer to an other custom table item?

Kentico has a default form control for this.

  • Create a new field of Data type: GUID
  • Choose as form control: 'Custom table item selector'
  • insert a Format of the display name. Here you pick the field(s) of the other custom table column you want to display, for instance {%Title%}
  • insert the name of the value column (this will be your reference), most likely the default ItemGUID

If you want to get this data from custom code you'll be getting the referenced item based on the ItemGUID, no custom query needed but something along the line of:

CustomTableItemProvider.GetItems(customTableClassName, where, null, topN, columns);

If you really need to fill some extra fields in your new Custom table based on the selection (which actually makes you save your data twice). I'd go with the above solution and create a custom event handler after this record was saved to update some extra none required and not visible/editable fields on-after-insert. But since you'd be storing your data twice I'd go with the first option.



0 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.