How to retrive 1 value from a page field

Alexander Gamper asked on February 13, 2016 14:56

Hello,

I search now for about 4 hours but in can't understand how do i retrive 1 value from a page type. I created a checkbox as a new field and now I want to get the value of this checkbox. Is there a simple way in vb.net?

thank you

Correct Answer

Alexander Gamper answered on February 13, 2016 17:30

OK i got it:

    Dim tree As New DocumentEngine.TreeProvider()
    Dim node As DocumentEngine.TreeNode
    node = tree.SelectSingleNode(CurrentPage.NodeID, "de-de")
    node.GetValue("NAMEOFFIELD")

thats it

0 votesVote for this answer Unmark Correct answer

Recent Answers


David te Kloese answered on February 13, 2016 16:39

Hi Alexander,

I'm not sure about VB.net.. but I think you should be able to use something like:

CMSContext.CurrentDocument.GetValue("someFieldName", "your custom default value")

This is if the value is present in the current document. Where is your code executing? I asume you're using the ASPX model?

Might also want to have a look at some documentation:

https://docs.kentico.com/display/K9Tutorial/Creating+pages+using+ASPX+templates

Or have a look at the API samples: https://docs.kentico.com/display/API9/Pages

Greets,

David

0 votesVote for this answer Mark as a Correct answer

Alexander Gamper answered on February 13, 2016 17:08

Hello David,

sorry but i can't find the namespace cmscontext in my .vb file. i use version 9.0. any suggestion? maybe a sample of how to get 1 value of the current page will be helpful.

thank you very much

0 votesVote for this answer Mark as a Correct answer

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