开发者

Source Code for Calling Multiple in ASP.NET MVC 2.0(ASPX Engine) Actions on a Link which is bound to Telerik MVC Grid Column

I need a Source Code for Calling Multiple in ASP.NET MVC 2.0(ASPX Engine) Actions on a Link which is bound to Telerik MVC Grid Column.

I am using Entity Framework , Linq to Entities , ASP.NET MVC 2 , Repository pattern and ASPX ViewEngine .

I have a Telerik MVC Grid Column as Status . This column is bound to a ClientTemplate ( ActionLink Format) as " View " . Wh开发者_运维百科en a user clicks on " View " .

Multiple Telerik MVC Grids which showing 1. Problem Log . ( Visible only if Status is " Account is in Error" otherwise show last Cleared Problem ( Problem text and Problem Description coming from DB, Can be shown only in a TextBox(problem Name,) " In error" and a div " description of Problem" )

  1. Status History .

  2. Bank account information for logged User

  3. Admin Information

should be displayed ..

from Status Grid Column I am fetching a Bank Account Number and my Status is coming from another table ..

now my problem is that how to call multiple actions present in my controller ( with conditions ) ?

Can anybody guide me with working code if any ?:(

if possible mail me on ashes22@gmail.com


When view is clicked you want to show a new view that contains then calls to other action methods in your controller(s) or other views.

So for example when you click on the View link on the grid, you would then have the view link go to another Route (and in turn another controller). So lets say the "view" link brings you to a controller named CombinedStatusController

Then in your /Views/CombinedStatusController/Index.aspx you call RenderAction to call a method on each controller here Im assuming named StatusController, BankAccountController, AdminInformationController each with a method: public ActionResult Index(int statusId)...

<%=Html.RenderAction("Index", "Status", new { statusId = statusId} ) %>

<%=Html.RenderAction("Index", "BankAccount", new { statusId = statusId} ) %>

<%=Html.RenderAction("Index", "AdminInformation", new { statusId = statusId} ) %>

Each one of those actions would then return a view with a telerik grid in it. So you have three separate views that are getting created by calling one parent view of CombinesStatusController.

Now - another option instead of Html.RenderAction is Html.RenderPartial. The difference is RenderPartial goes directly to a view (without going through your controller) and passes over a copy of the current model to it. In your case you need to retrieve data specific to a statusId so I would not use RenderPartial here but RenderAction.

Hope this helps a bit : )


You don't call multiple Actions from the front-end. You call one and have that one call other Action (or non-Action) methods within the Controller.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜