Deepika Chaudhary

Deepika Chaudhary

  • 1.3k
  • 136
  • 97.7k

MVC Actionlink with (RouteValueDictionary)ViewBag.GridState

Jul 26 2013 6:59 AM
Hi,

I have an mvc application with telerik grid.
Inside telerik gird i have one column template field where i want to use actionlink.

In the action link I want to pass (RouteValueDictionary)ViewBag.GridState and confirm message dialog.

How can i do this?

It is giving error if i am using it with (RouteValueDictionary)ViewBag.GridState

Instead of new { onclick = "return confirm('Are you sure?');" }) if i pass null then it works but i want confirm dialog before it go to control action method.

This is the code what i am trying.

columns.Template(
    @<text>
    @{ ViewBag.GridState["id"] = @item.BATCHID;
       ViewBag.GridState["CurrentView"] = "Index";
       ViewBag.GridState["fromPeriod"] = Model.FromPeriod;
       ViewBag.GridState["toPeriod"] = Model.ToPeriod;
       }
   
        @Html.ActionLink("Set Poster", "SetPosterBy","Batch",(RouteValueDictionary)ViewBag.GridState, new { onclick = "return confirm('Are you sure?');" })
   
    </text>
).Width(200).Title("SET POSTED/CLOSED/QAED BY");


Please help.

Answers (5)