API Questions on Kentico API.
Version 5.x > API > Custom table and custom event handler View modes: 
User avatar
Member
Member
wtzeng-micro-datanet - 8/16/2011 2:38:09 PM
   
Custom table and custom event handler
Hi
If I created a custom table and custom event handler to do additional then onbeforeinsert and onafterinsert, will the custom event handler able to catch then my customer table is been insert?

Thanks

Wei

User avatar
Member
Member
wtzeng-micro-datanet - 8/16/2011 3:13:01 PM
   
RE:Custom table and custom event handler
sorry correction.. I meant if data been insert into my Custom Table, will the custom event handler able to catch?

User avatar
Kentico Developer
Kentico Developer
kentico_ivanat - 8/17/2011 1:28:08 AM
   
RE:Custom table and custom event handler
Hi,

for this purpose you can use custom data handler. In a OnBeforeInsert event you can implement your code.

Best regards,
Ivana Tomanickova

User avatar
Member
Member
wtzeng-micro-datanet - 8/17/2011 8:53:06 AM
   
RE:Custom table and custom event handler
So Custom Data Handler will able to catch when data insert, modify, or delete on the custom table I created?

User avatar
Kentico Developer
Kentico Developer
kentico_ivanat - 8/17/2011 9:11:20 AM
   
RE:Custom table and custom event handler
Hi,

yes, it is designed this way. To update only your custom table data you need to set correct class name in the condition:

if (dataItem.ClassName.ToLower() == "cms.mycustomtable")

Alternatively, you could insert your code into following events:
OnBeforeExecuteQuery and OnAfterExecuteQuery

Best regards,
Ivana Tomanickova

User avatar
Member
Member
wtzeng-micro-datanet - 8/17/2011 9:19:42 AM
   
RE:Custom table and custom event handler
thanks

User avatar
Guest
jh - 11/4/2011 9:21:20 AM
   
RE:Custom table and custom event handler
kentico_ivanat wrote: Hi,

yes, it is designed this way. To update only your custom table data you need to set correct class name in the condition:

if (dataItem.ClassName.ToLower() == "cms.mycustomtable")

Alternatively, you could insert your code into following events:
OnBeforeExecuteQuery and OnAfterExecuteQuery

Best regards,
Ivana Tomanickova