API
Version 7.x > API > Get the current page ID for a forms control View modes: 
User avatar
Certified Developer 8
Certified Developer 8
nrinat-ecentricarts - 8/7/2013 10:30:09 AM
   
Get the current page ID for a forms control
Hello

I have a form control that works with data from a custom table.
The instance of form control itself is stored in a designated table: CONTENT_MenuItem_1.

When the user saved data in the form control (under the page Form tab) I would like to update the form control's record in the content table with the current page ID, so that I will be able to filter data for the form control according to the page the user is editing.

In order to do that I need to identify the MenuItemID or MenuItemName, find them in the content table and update the record. I am having hard time finding that information in code.

I am trying to find what information I have at the control's OnBeforeSave event:
* sender - contains information about the custom table. I need a higher level that would provide information about the form control itself, not what it manages.
* CMSContext.CurrentDocument is null.
* CMSContext.CurrentPageInfo is null.
* The DataClassInfo and CalssFormDefinitions hold the definition only (I can see the names of the columns that I need but not the values)

My questions are:
1. How do I get the MenuItemID or MenuItemName of the current document the user is working on?
2. How do I get the current tree node GUID in order to update the form control's content record?


Thank you!

Norm



User avatar
Kentico Support
Kentico Support
kentico_jurajo - 8/8/2013 1:06:43 AM
   
RE:Get the current page ID for a forms control
Hi,

If I am getting this right, you want to update some records in some custom table when a document is edited on the Form tab in CMS Desk?

If so, I would use the document event on after save and you can get the data from the event parameters or from the frame's URL - there is a query string with NodeID - having NodeID you can get all other data you need.

Best regards,
Juraj Ondrus

User avatar
Certified Developer 8
Certified Developer 8
nrinat-ecentricarts - 8/8/2013 8:55:37 AM
   
RE:Get the current page ID for a forms control
Thank you Juraj!

Request.Params["nodeid"] is what I needed.

Your help is much appreciated.