Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7408081
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T05:50:50+00:00 2026-05-29T05:50:50+00:00

I need to choose my spark master layout every time a request for a

  • 0

I need to choose my spark master layout every time a request for a page is made. I attempted to so this by setting a ViewBag.Layout value in OnActionExecutingand referencing this value in the master layout ref.

<use master="${ViewBag.Layout}"/>

However, this doesn’t work, it seems as if spark is not treating the code within the brackets not as code, but as a string. I get the following error:

The view 'Index' or its master was not found or no view engine supports the searched locations. The following locations were searched:
~/Views/Home/Index.aspx
~/Views/Home/Index.ascx
~/Views/Shared/Index.aspx
~/Views/Shared/Index.ascx
~/Views/Home/Index.cshtml
~/Views/Home/Index.vbhtml
~/Views/Shared/Index.cshtml
~/Views/Shared/Index.vbhtml
Layouts\${ViewBag.Layout}.spark
Shared\${ViewBag.Layout}.spark

Can anyone tell me why this is? Or point me to an alternative way of doing this?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-29T05:50:52+00:00Added an answer on May 29, 2026 at 5:50 am

    The layout cannot be dynamically selected using code syntax. The reason for this is that that layout is selected prior to any rendering taking place in the engine. So first the layout is located, and then the engine tries to render all the variables in place. Using a variable for the layout means that the rendering engine doesn’t know which file to open.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

There are a multitude of key-value stores available. Currently you need to choose one
I need know how change Choose a value... in controlType: CategoryFilter of ControlWrapper Example:
This question relates to Simulating file system access . I need to choose files
Often I need to choose what to do according to the value of a
I need to choose a compression algorithm to compress some data. I don't know
If I need to choose a collation mode to work with, how do I
I'm need to choose a software package for installing software. NSIS and WiX seem
As part of a numerical library test I need to choose base 10 decimal
In our COM project, we need to choose between best string class implementation so
I've used both SVN and CVS a little bit, but will need to choose

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.