ASPX templates
Version 3.x > ASPX templates > Use item-properties in code-behind View modes: 
User avatar
Member
Member
Michael - 12/21/2008 2:56:58 PM
   
Use item-properties in code-behind
Hello!

How can i get and use the values of a document-type/item displayed in a datalist or repeator-control in the code-behind of a template aspx?

It is no problem getting the values in the transformations using code like <%# Eval("SortIndex") %>. - But i need the values of a selected item in a datalist also in the codebehind of template page.

Can someone hellp me? - Thanks! Michael

User avatar
Kentico Developer
Kentico Developer
kentico_helenag - 12/22/2008 5:19:20 AM
   
RE:Use item-properties in code-behind
Hello Michael,

could you please tell us more details about what you would like to achive? What should it be in the code behind?

Thank you in advance.

Best regards,
Helena Grulichova

User avatar
Member
Member
Michael - 12/22/2008 6:50:29 AM
   
RE:Use item-properties in code-behind
Hello Helena,

Because we buyed and use Kentico CMS in our company now, i want to practise web development with Kentico. To do this, i decided to relaunch my private web page using the free version of Kentico and migrate the functions to the Kentico-CMS.

In my "old" ASP.NET-Projekt i defined a Video-Class with some properties. I also had a DAL-Class which had a method GetVideo(int id) to get a specific Video-Object (instance from the video-class).
This DAL-Class was used to retreive a video-object in the code behind of a web-page. The properties of the retrieved video-object where used to set some properties of a video-viewer-control. (Call Select-method of DAL-Object and set properties in the code-behind of 1 web-page).

Now i thought that it is a good idea to use document-types instead of "normal" classes. So in future i do not need do write object-classes and DAL-Classes for selecting, updating or delete objects.

So, it is no problem to list all the video-documents, wtih all field-values, on a web-page. (Using datalist or repeater)
I want that a user can select a object or click a Button for each object. When this is done, the field-values should be used to set the properties of the video-viewer.
(for example. volument, video-url, etc.)

Thanks for your help!
Michael

User avatar
Kentico Developer
Kentico Developer
kentico_helenag - 12/22/2008 7:26:10 AM
   
RE:Use item-properties in code-behind
Hello Michael,

thank you for your reply.

If you would use our controls, i.e. CMSRepeater or CMSDataList you should place the video-viewer into the SelectedItemTransformation and set the values with the help of macro you mentioned.

Another possibility is to use the standard ASP.NET controls, i.e. Repeater or DataList and use their Selected values properties (e.g. RepeaterID.SelectedValue). For selecting documents as sources for those controls you could use our API. Please see here for some sample codes: http://www.kentico.com/docs/devguide/selecting_nodes.htm

Best regards,
Helena Grulichova

User avatar
Member
Member
michael.karl.privat-aon - 12/22/2008 7:29:18 AM
   
RE:Use item-properties in code-behind
Hello Helena!

Thank you so much for your help!

Merry Chirstmas!
Michael