开发者

JCrop Problem with asp.net masterpage

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>


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 !


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
        });
    });

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜