Delhi, , India
HTML, ASP Dot Net, SQL Server
0 Comment | 12 Views | 23 Jan 18  | Somnath Das
How to pass ViewData value to a partial view ?
string Value = "Somnath";
DataTable dt = new DataTable();
@Html.Partial("~/Views/Shared/_PartialView.cshtml", dt, new ViewDataDictionary(this.ViewData) { { "ViewDataValue", Value } })

Here "Value" is the data which you want to pass through your ViewData
ViewData["ViewDataValue"] = Value;

Here "dt" is data which you want to pass to you partial view.

    • Social Share
      for this Blog