I looked around and I can’t find a solution, so I am here. from what I read, I could do this in asp.net web forms using RegisterClientScript or RegisterClientScriptBlock. I cannot find this in any MVC3 documentation. I have the following function in MVC 3 View:
MyTest View:
<div data-role="content">
<div id="mappingTable"></div>
</div>
</section>
@section Scripts {
<script type="text/javascript">
$("#jqm-home").live('pageinit', function () {
addTableRow(' adding data to table <br/>');
});
function addTableRow(msg) {
$('#mappingTable').append(msg);
};
</script>
}
In My Controller, I have the following.
public class MyTestController : Controller
{
#region Class Constractor
public MyTestController()
{
Common.ControllerResourceEvent += new System.EventHandler<ResourceEventArgs>(Common_ResourceEvent);
}
private void Common_ResourceEvent(object sender, ResourceEventArgs e)
{
}
#endregion Class Constractor
public ActionResult Index()
{
return View();
}
}
source
share