Adding Spark Partial View dynamically

2 views
Skip to first unread message

Jaikishan Jalan

unread,
Jul 2, 2010, 2:18:51 AM7/2/10
to spar...@googlegroups.com
Hello,

This is my first time with Spark. I have two questions pertaining to add Spark views:

[1] I am curious how can we add a partial spark view ( I am treating a partial view as a user control ) to a page (another spark view) dynamically, as opposed to adding if logic in spark file and deciding which control to add. For example, we can do so in ASP.NET code behind as this.form1.controls.add("path to ascx file")? 

[2] Also is it possible to attach a code behind with a partial view ? I know this is not really inline with ASP.NET MVC guidelines where you want to do all business logic in controller and view just consumes the view data. What I am trying to achieve is some processing on the data after which the control has been passed from controller to view. I want to separate out the post-processing logic so that in future if I decide to render the control differently, I can reuse this post-processing unit. One way I can think of is to write a model for a control, use the class in the spark view, pass the viewdata to the model, do some processing on it and return it back to the partial spark view.

I would appreciate if somebody could give pointers on how to do this in "Spark" way.

--
Thanks,
Jaikishan
Reply all
Reply to author
Forward
0 new messages