Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Scott 69 posts 146 karma points
    Feb 29, 2012 @ 19:49
    Scott
    0

    Get a page field value in ASP.Net

    I have a number of content pages that are using the same template. On my document type I have a radiobuttonlist. I'm hoping that with some inline asp.net within my content pages template I can capture the value of that radiobuttonlist.

    i.e. something like

    <%

       string myVariable = some.umbraco.library(CurrentPage.Field("fieldname"));

       if (myVariable == "some value") then 

    ....etc

    %>

    Oh and better still since its a radiobutton I need to be able to do something like what umbraco.library:GetPreValueAsString does in xslt so that I get the actual string value.

     

     

  • Scott 69 posts 146 karma points
    Feb 29, 2012 @ 21:50
    Scott
    1

    Is this possible?

  • Scott 69 posts 146 karma points
    Feb 29, 2012 @ 22:09
    Scott
    0

    I figured it out:

     

    <%@ import namespace="umbraco.BusinessLogic" %>
    <%@ import namespace="umbraco.cms.businesslogic.web" %>
    <%  
      Document doc new Document(umbraco.presentation.UmbracoContext.Current.PageId.Value);
      int groupID Convert.ToInt32(doc.getProperty("groupNamePicker").Value);
      string groupName umbraco.library.GetPreValueAsString(Convert.ToInt32(groupID));

    %>

Please Sign in or register to post replies

Write your reply to:

Draft