I am trying to load the cropped image into the asp:image without using Updatepanel. But the problem is it displays the image but it needs to load the $('.image-cropper').each(linkUp); function which is present in the jQuery(window).load() to start the cropping process. But using the RegisterClientScriptBlock method it would not fire that function. Note: $('.image-cropper').each(linkUp); should be initiated only after the image has been updated with new image. Can anyone let me know where the error is?
using System;
using System.Collections.Generic;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using ImageResizer;
using System.Text;
public partial class Advanced : System.Web.UI.Page {
protected void Page_Load(object sender, EventArgs e) {
ScriptManager1.RegisterAsyncPostBackControl(Button1);
if(!IsPostBack)
Image1.ImageUrl = "fountain-small.jpg?width=300";
if (Page.IsPostBack && !string.IsNullOrEmpty(img1.Value))
ImageBuilder.Current.Build("~/"+ImageResizer.Util.PathUtils.RemoveQueryString(img1.Value), "~/cropped.jpg", new ResizeSettings(img1.Value));
}
protected void Button1_Click(object sender, EventArgs e)
{
Image1.ImageUrl = "cropped.jpg?width=300";
UpdatePanel1.Update();
string key = "executeCropScript";
Page.ClientScript.RegisterClientScriptBlock(this.GetType(), key, "<script
type=\"text/javascript\">jQuery(window).load();</script>", false);
}
}