Variable file name in render partial

7 views
Skip to first unread message

Jaikishan Jalan

unread,
Jul 2, 2010, 2:30:36 PM7/2/10
to spar...@googlegroups.com
When I try to do the following

<var file='String.format("{0}/{1}","x","_test")' />
<render partial=file />

it does not render the partial view. Instead it outputs the following in html response

<render partial=x/_test />

(which tell me that I am missing the double quotes around the file path). However, when I hardcode the partial view file name in my spark view, i.e

<render partial="x/_test" />

it does render the partial view in my final html response (which means that partial file does exists).

I tried the following but ended up without success

[1] 

<var file='String.format("\"{0}/{1}\"","x","_test")' />
<render partial=file />

This outputs <render partial="x/_test" /> in the html response

[2] 

<var file="'String.format("{0}/{1}","x","_test")'" />
<render partial=file />

This outputs both the line <var file=... /> and <render partial=file /> to html response

[3] 

<var file='String.format("{0}/{1}","x","_test")' />
<render partial=${file} />

This renders <render partial=x/_test /> in html response.

I tried several other combination like putting quotes around file variable in render partial but nothing seems to be working. Can anybody give any pointers as to how to use a variable as a file name to render a partial view ?

--
Thanks,
Jaikishan

Jaikishan Jalan

unread,
Jul 2, 2010, 3:02:58 PM7/2/10
to spar...@googlegroups.com
Looks like I need to create a block inheriting from IBlock in ASP.NET or ViewComponent in MonoRail to solve this problem.
--
Thanks,
Jaikishan
Reply all
Reply to author
Forward
0 new messages