You are populating the model inside the view???? In the MVC pattern views are intended to display data that is passed to them under the form of a model. It is the controller's responsibility to populate this model.
This being said let's suppose that you have a model:
public class MyViewModel
{
public int[][] BgtArray { get; set; }
}
which is populated inside the controller action and passed to the view:
public class HomeController : Controller
{
public ActionResult Index()
{
var model = new MyViewModel
{
BgtArray = Enumerable
.Range(1, 10)
.Select(
i => Enumerable
.Range(1, 10)
.Select(j => i * j)
.ToArray()
)
.ToArray()
};
return View(model);
}
}
and then we could have a corresponding strongly typed view in which we could JSON serialize the model and access it in javascript:
@model MyViewModel
<script type="text/javascript">
var model = @Html.Raw(Json.Encode(Model));
alert(model.BgtArray[1][2]);
</script>
which will be rendered in the browser like this:
<script type="text/javascript">
var model = {"BgtArray":[[1,2,3],[2,4,6],[3,6,9]]};
alert(model.BgtArray[1][2]);
</script>
As far as the following line is concerned:
<input type="hidden" value="@Model.BgtArray" id="BudgetArray"/>
it's pretty useless because you cannot store entire complex object graphs into a hidden field. The rendered result will be:
<input type="hidden" value="System.Int32[][]" id="BudgetArray"/>
which is very unlikely to be what you are trying to achieve.