Skip to main content
deleted 484 characters in body
Source Link
Falak Mahmood
  • 17.3k
  • 2
  • 41
  • 67

Update: Is there an another way to get just the value out of the page content type field?

Yes, you You can only get the value out of page Content Type field:

in using the C#, it would be like:

string valueoffield = (string)SPContext.Current.ListItem["YourContentTypeFieldName"];

Remember: By default code blocks are not allowed on Master pages or Page layouts, but can allow them in web.config using the following code:

 <pageparserpaths>      
    <pageparserpath virtualpath="/_catalogs/masterpage/*" compilationmode="Always"           allowserversidescript="true" includesubfolders="true".>
    </pageparserpaths>

Update: Is there an another way to get just the value out of the page content type field?

Yes, you can get the value out of page Content Type field:

in C#, it would be like

string valueoffield = (string)SPContext.Current.ListItem["YourContentTypeFieldName"];

Remember: By default code blocks are not allowed on Master pages or Page layouts, but can allow them in web.config using the following code:

 <pageparserpaths>      
    <pageparserpath virtualpath="/_catalogs/masterpage/*" compilationmode="Always"           allowserversidescript="true" includesubfolders="true".>
    </pageparserpaths>

You can only get the value out of page Content Type field using the C#:

string valueoffield = (string)SPContext.Current.ListItem["YourContentTypeFieldName"];
deleted 192 characters in body
Source Link
Falak Mahmood
  • 17.3k
  • 2
  • 41
  • 67

Update: Is there an another way to get just the value out of the page content type field?

Yes, you can get the value out of page Content Type field:

in C#, it would be like

string valueoffield = (string)SPContext.Current.ListItem["YourContentTypeFieldName"];

From ASPX/Html page, your code will look like. Note: you must have URL field

<a href='<%=GetURLFieldValue("YourContentTypeFieldName") %>'  rel="test" title="Test">
</a>

Remember: By default code blocks are not allowed on Master pages or Page layouts, but can allow them in web.config using the following code:

 <pageparserpaths>      
    <pageparserpath virtualpath="/_catalogs/masterpage/*" compilationmode="Always"           allowserversidescript="true" includesubfolders="true".>
    </pageparserpaths>

Update: Is there an another way to get just the value out of the page content type field?

Yes, you can get the value out of page Content Type field:

in C#, it would be like

string valueoffield = (string)SPContext.Current.ListItem["YourContentTypeFieldName"];

From ASPX/Html page, your code will look like. Note: you must have URL field

<a href='<%=GetURLFieldValue("YourContentTypeFieldName") %>'  rel="test" title="Test">
</a>

Remember: By default code blocks are not allowed on Master pages or Page layouts, but can allow them in web.config using the following code:

 <pageparserpaths>      
    <pageparserpath virtualpath="/_catalogs/masterpage/*" compilationmode="Always"           allowserversidescript="true" includesubfolders="true".>
    </pageparserpaths>

Update: Is there an another way to get just the value out of the page content type field?

Yes, you can get the value out of page Content Type field:

in C#, it would be like

string valueoffield = (string)SPContext.Current.ListItem["YourContentTypeFieldName"];

Remember: By default code blocks are not allowed on Master pages or Page layouts, but can allow them in web.config using the following code:

 <pageparserpaths>      
    <pageparserpath virtualpath="/_catalogs/masterpage/*" compilationmode="Always"           allowserversidescript="true" includesubfolders="true".>
    </pageparserpaths>
deleted 99 characters in body
Source Link
Falak Mahmood
  • 17.3k
  • 2
  • 41
  • 67

By default code blocks are not allowed on Master pages or Page layouts.

You have to allow them in web.config using the following code:

<pageparserpaths>
<pageparserpath virtualpath="/_catalogs/masterpage/*" compilationmode="Always" allowserversidescript="true" includesubfolders="true".>
</pageparserpaths>

Update: You asked ifIs there isan another way to get just the value out of the page content type field?

YouYes, you can use the code below to get the value out of page Content Type field for e.g. name of field is YourContentTypeFieldName:

From code behindin C#, the code will lookit would be like following:

string valueoffield = (string)SPContext.Current.ListItem["YourContentTypeFieldName"];

From ASPX/Html page, your code will look like. Note: you must have URL field

<a href='<%=GetURLFieldValue("YourContentTypeFieldName") %>'  rel="test" title="Test">
</a>

Remember: By default code blocks are not allowed on Master pages or Page layouts, but can allow them in web.config using the following code:

 <pageparserpaths>      
    <pageparserpath virtualpath="/_catalogs/masterpage/*" compilationmode="Always"           allowserversidescript="true" includesubfolders="true".>
    </pageparserpaths>

By default code blocks are not allowed on Master pages or Page layouts.

You have to allow them in web.config using the following code:

<pageparserpaths>
<pageparserpath virtualpath="/_catalogs/masterpage/*" compilationmode="Always" allowserversidescript="true" includesubfolders="true".>
</pageparserpaths>

Update: You asked if there is another way to get just the value out of the page content type field?

You can use the code below to get value out of page Content Type field for e.g. name of field is YourContentTypeFieldName

From code behind, the code will look like following:

string valueoffield = (string)SPContext.Current.ListItem["YourContentTypeFieldName"];

From ASPX page, code will look like. Note: you must have URL field

<a href='<%=GetURLFieldValue("YourContentTypeFieldName") %>'  rel="test" title="Test">
</a>

Update: Is there an another way to get just the value out of the page content type field?

Yes, you can get the value out of page Content Type field:

in C#, it would be like

string valueoffield = (string)SPContext.Current.ListItem["YourContentTypeFieldName"];

From ASPX/Html page, your code will look like. Note: you must have URL field

<a href='<%=GetURLFieldValue("YourContentTypeFieldName") %>'  rel="test" title="Test">
</a>

Remember: By default code blocks are not allowed on Master pages or Page layouts, but can allow them in web.config using the following code:

 <pageparserpaths>      
    <pageparserpath virtualpath="/_catalogs/masterpage/*" compilationmode="Always"           allowserversidescript="true" includesubfolders="true".>
    </pageparserpaths>
added 32 characters in body
Source Link
Falak Mahmood
  • 17.3k
  • 2
  • 41
  • 67
Loading
added 236 characters in body
Source Link
Falak Mahmood
  • 17.3k
  • 2
  • 41
  • 67
Loading
Source Link
Falak Mahmood
  • 17.3k
  • 2
  • 41
  • 67
Loading