.net - ASP.NET C# Error: Object Event is undefined -
I'm getting an EVENT undefined rror in ASP.NET C # code. I am dynamically creating image buttons and clearly specifying them on a click event. After clicking on the user thumbnail, that page is directed to the page that contains the blurry image of that thumbnail. When the user presses the back button to go to the original page then it is a place where things are interesting, if the user tries to click on a thumbnail again, then click the image button with an error of browser fail to reconigze the event. Stays postback "" event is undefined. This error is random, it's always after a minimum of one ", but when this happens, the sequence is not consistent. Very interesting, it's only in IE. Google Chrome and Firefox worked fine and the event Recognized I have played around the ViewState property, but it has not worked. Any idea?
Protected Zero ImageButton_Click (Object Sender, ImageClickEventArgs e) {ImageButton IB = (ImageButton) this; Server .Transfer (@ "FullImage.aspx file =" + HttpUtility.UrlEncode ("~ / Galler Files / RegSize / Pick "+ ib.CommandArgument +" .jpg "));} Protected Zero Page_Load (Object Sender, EventArgs e) {// Thumbnail images array containing file locations of string [] Files = n ull; Files = Directory.GetFiles (Server.MapPath ("~ / Gallery / Pictures / RegSize"), "* .jpg"); for (int i = 0; I & lt; files.Length; i ++) {System.Web .UI.WebControls.Image imgWeb = New System.Web.UI.WebControls.Image (); // Image Size Info Bitmap bmp = Create Bitmap to Retrieve New Bitmaps (Server.MapPath ("~ / Gallery / Picture / RegSize / pic "+ i.ToString () +" .jpg ")); // Create a dynamic image button to capture the image system. Web. UI. WebControl Imagebutton imgbtn = new system Web. UI. WebControl ImageButtons (); ImgBtn.Click + = New ImageClickEventHandler (ImageButton_Click); ImgBtn.Attributes.Add ("OnClick", "ImageButton_Click"); //imgBtn.EnableViewState = false; ImgBtn.ImageUrl = "~ / Gallery / Picture / RegSize / pic" + i.ToString () + ".jpg"; ImgBtn.CommandArgument = i.ToString (); Set the width / height of the image button according to // bitmap width / height imgBtn.Width = resize (BMP size, 200, 200, "WIDTH"); ImgBtn.Height = Resize (bmp.size, 200, 200, "HEIGHT"); ImgBtn.Style.Add (HtmlTextWriterStyle.BackgroundColor, "white"); ImgBtn.Style.Add (HtmlTextWriterStyle.Margin, "5px"); // Set the bitmap, no need for it bmp.Dispose (); //imgBtn.ImageUrl = @ "thumbnail.aspx? File = \ gallery \ picture \ regsize \ pic" + i.ToString () + ".jpg"; //imgBtn.PostBackUrl = @ "FullImage.aspx file =?" + HttpUtility.UrlEncode ("~ / Gallery / Picture / RegSize / Pick" + i.ToString () + '.jpg "); divDisplay.Controls.Add (imgBtn);}
There may be a lot of things here, but first of all, I see that you should not have new control and page_load in their page. (), Since in a postback, the viewstate will be used to restore the state of control already.
Instead, you will see page_ If it does not fix it: Do you have output caching or client-side caching configured for this page? When you do back in the browser Is the page re-requested from the server then? Have you seen HTTP chat with Fidler?
In addition to this, a minor issue: clearly for bitmap compared to dissection () To "experiment" Yoga is better.
Comments
Post a Comment