开发者

ASP.Net MVC ParitalView and Javascript / jQuery?

开发者 https://www.devze.com 2023-03-05 01:45 出处:网络
Is it possible to have a PartialView execute the jQuery ready function on load of the PartialView. I do this all of the time in a regular View.

Is it possible to have a PartialView execute the jQuery ready function on load of the PartialView. I do this all of the time in a regular View.

For example, I want to do something like this:

<%@ Control Language="C#" Inherits="Syst开发者_如何学Pythonem.Web.Mvc.ViewUserControl<MainConfig.Models.ProfileAddress>" %>

<script type="text/javascript">

     $(function () {        

        alert('I am in ProfileAddress PartialView');
     }

</script>

Partial View Html Code Here

Maybe I have to do something on the server side.

Please let me know.


Yes, it is possible. Your code will work as long as the partial view is rendered.

0

精彩评论

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