开发者

Pass Value from Controller to a class asp.net MVC3.0

I have a Controller which is receiving value as an output param开发者_如何转开发eter from the database and I want that value to be passed to a .cs page created and use that value there.Can U please help me to know how can i Pass the value from controller to class. Thanks....


Inside the controller you could instantiate the class and invoke some method on it by passing the value you retrieved from the database as parameter:

public ActionResult Index()
{
    string value = ... // retrieve the value from database

    // instantiate the class
    SomeClass someClass = new SomeClass();

    // call some method and pass the value
    someClass.SomeMethod(value);

    return View();
}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜