JCrop asp.net 母版页的问题

发布于 2024-12-01 21:45:39 字数 1861 浏览 0 评论 0原文

我有一个 MasterPage、defaultPage 和 Cropper 页面,当我只有 default.aspx 页面而没有母版页和 Cropper 页面时,我可以使用 JCrop。

问题:当我有母版页时,我无法使用 Jcrop,因为它没有显示图像裁剪器矩形。

任何帮助将不胜感激!

这是我的代码:

母版页的头部:

 <link href="css/jquery.Jcrop.css" rel="stylesheet" type="text/css" />
<script src="js/jquery-1.6.2.js" type="text/javascript"></script>
<script src="js/jquery.Jcrop.min.js" type="text/javascript"></script>
<script src="js/jquery.Jcrop.js" type="text/javascript"></script>
<script src="js/jquery.color.js" type="text/javascript"></script>
<asp:ContentPlaceHolder id="head" runat="server">
</asp:ContentPlaceHolder>

母版页的正文部分:

<form id="form1" runat="server">
<div>
    <asp:ContentPlaceHolder id="ContentPlaceHolder1" runat="server">

    </asp:ContentPlaceHolder>
</div>
</form>

这是我的 Cropper.aspx 代码:

<asp:Panel ID="pnlUpload" runat="server">
  <asp:FileUpload ID="Upload" runat="server" />
  <br />
  <asp:Button ID="btnUpload" runat="server" OnClick="btnUpload_Click" Text="Upload" />
  <asp:Label ID="lblError" runat="server" Visible="false" />
</asp:Panel>
<asp:Panel ID="pnlCrop" runat="server" Visible="false">
  <asp:Image ID="imgCrop" runat="server" />
  <br />
  <asp:HiddenField ID="X" runat="server" />
  <asp:HiddenField ID="Y" runat="server" />
  <asp:HiddenField ID="W" runat="server" />
  <asp:HiddenField ID="H" runat="server" />
  <asp:Button ID="btnCrop" runat="server" Text="Crop" OnClick="btnCrop_Click" />
</asp:Panel>
<asp:Panel ID="pnlCropped" runat="server" Visible="false">
  <asp:Image ID="imgCropped" runat="server" />
</asp:Panel>

I have a MasterPage,defaultPage and Cropper page and I am able to use JCrop when I have only default.aspx page and not master page and the cropper page.

Problem:When I have am having masterpage then I am unable to use the Jcrop as it is not showing the Image Cropper rectangle.

Any help will be appreciated!

Here is my code:

Head part of Master Page:

 <link href="css/jquery.Jcrop.css" rel="stylesheet" type="text/css" />
<script src="js/jquery-1.6.2.js" type="text/javascript"></script>
<script src="js/jquery.Jcrop.min.js" type="text/javascript"></script>
<script src="js/jquery.Jcrop.js" type="text/javascript"></script>
<script src="js/jquery.color.js" type="text/javascript"></script>
<asp:ContentPlaceHolder id="head" runat="server">
</asp:ContentPlaceHolder>

Body Part of MasterPage:

<form id="form1" runat="server">
<div>
    <asp:ContentPlaceHolder id="ContentPlaceHolder1" runat="server">

    </asp:ContentPlaceHolder>
</div>
</form>

Here is my Cropper.aspx code:

<asp:Panel ID="pnlUpload" runat="server">
  <asp:FileUpload ID="Upload" runat="server" />
  <br />
  <asp:Button ID="btnUpload" runat="server" OnClick="btnUpload_Click" Text="Upload" />
  <asp:Label ID="lblError" runat="server" Visible="false" />
</asp:Panel>
<asp:Panel ID="pnlCrop" runat="server" Visible="false">
  <asp:Image ID="imgCrop" runat="server" />
  <br />
  <asp:HiddenField ID="X" runat="server" />
  <asp:HiddenField ID="Y" runat="server" />
  <asp:HiddenField ID="W" runat="server" />
  <asp:HiddenField ID="H" runat="server" />
  <asp:Button ID="btnCrop" runat="server" Text="Crop" OnClick="btnCrop_Click" />
</asp:Panel>
<asp:Panel ID="pnlCropped" runat="server" Visible="false">
  <asp:Image ID="imgCropped" runat="server" />
</asp:Panel>

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

贱贱哒 2024-12-08 21:45:39

您包含 jCrop 两次

<script src="js/jquery.Jcrop.min.js" type="text/javascript"></script>
<script src="js/jquery.Jcrop.js" type="text/javascript"></script>

只需要一次!

You include jCrop two times

<script src="js/jquery.Jcrop.min.js" type="text/javascript"></script>
<script src="js/jquery.Jcrop.js" type="text/javascript"></script>

Only one is necessary !

注定孤独终老 2024-12-08 21:45:39

终于找到解决办法了,很简单,添加服务器控制的代码即可。

这是我修改的代码:

 <script type="text/javascript">
    jQuery(document).ready(function () {
        jQuery('#<%= imgCrop.ClientID %>').Jcrop({
            onSelect: storeCoords
        });
    });

Found the solution at last and it's a simple one to add in the code for server control.

Here is the code I modified:

 <script type="text/javascript">
    jQuery(document).ready(function () {
        jQuery('#<%= imgCrop.ClientID %>').Jcrop({
            onSelect: storeCoords
        });
    });

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文