views:

176

answers:

2

im extending the htmlhelper. but it i cannot call the renderaction of it.

 using System.Text;
 using System.Web.Mvc;
 using System.Web.Mvc.Html;
 public static class ViewHelpers
    {
        public static string Text(this HtmlHelper htmlHelper, string name, object value, bool isEditMode)
        {
           htmlHelper.RenderAction(...) //cannot be called
        }
    }

how can i call the RenderAction???

+2  A: 

@CoffeeCode, could you explain why you'd like to do this?

Generally speaking you would call a helper to return html as a string which is then rendered in the page.

It seems a little weird to want to render it within the helper. At least to me anyway.

edit

i think a helper here might be the wrong thing for you. if you want access to the list, but you don't want to pass it to the view then a helper is the wrong place. You may want to create a class that takes the list, does stuff with it and then return html.

griegs
its just that i have an action that return a view result, which is a dropdown list. i dont whant to pass the list of elements to the view, because i want it simple as possible. and i dont have access to the domain model in my htmlhelper. so im trying to call the RenderAction.
CoffeeCode
A: 

the solution was realy easy.
add using Microsoft.Web.Mvc;
and when calling the RenderAction it will write the html string to the directly to the view

CoffeeCode