View Single Post
  #9 (permalink)  
Old February 1st, 2015, 01:39 PM
wassim84 wassim84 is offline
Authorized User
Points: 73, Level: 1
Points: 73, Level: 1 Points: 73, Level: 1 Points: 73, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jan 2015
Posts: 16
Thanks: 5
Thanked 0 Times in 0 Posts
Default

It would help if you answered the questions I asked in my previous post:

1. Can you be more specific about the actual error message and when it occurs? (When meaning where in the code; the stack trace you should see in the browser would help.)



[NullReferenceException: Object reference not set to an instance of an object.]
_ManagePhotoAlbum.ListView1_ItemInserting(Object sender, ListViewInsertEventArgs e) in c:\BegASPNET\Site\ManagePhotoAlbum.aspx.cs:33
System.Web.UI.WebControls.ListView.OnItemInserting (ListViewInsertEventArgs e) +112
System.Web.UI.WebControls.ListView.HandleInsert(Li stViewItem item, Boolean causesValidation) +230
System.Web.UI.WebControls.ListView.HandleEvent(Eve ntArgs e, Boolean causesValidation, String validationGroup) +623
System.Web.UI.WebControls.ListView.OnBubbleEvent(O bject source, EventArgs e) +227
System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs args) +37
System.Web.UI.WebControls.ListViewItem.OnBubbleEve nt(Object source, EventArgs e) +112
System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs args) +37
System.Web.UI.WebControls.Button.OnCommand(Command EventArgs e) +114
System.Web.UI.WebControls.Button.RaisePostBackEven t(String eventArgument) +159
System.Web.UI.WebControls.Button.System.Web.UI.IPo stBackEventHandler.RaisePostBackEvent(String eventArgument) +10
System.Web.UI.Page.RaisePostBackEvent(IPostBackEve ntHandler sourceControl, String eventArgument) +13
System.Web.UI.Page.RaisePostBackEvent(NameValueCol lection postData) +35
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1724


2. Also, did you try debugging the app to see where it breaks exactly?
When I am debuging it it crashes

It crashes in the bolded line below:
protected void ListView1_ItemInserting(object sender, ListViewInsertEventArgs e)
{
FileUpload FileUpload1 = (FileUpload)ListView1.InsertItem.FindControl("File Upload");
if (!FileUpload1.HasFile || !FileUpload1.FileName.ToLower().EndsWith(".jpg"))

{
CustomValidator cusValImage = (CustomValidator)ListView1.InsertItem.FindControl( "cusValImage");
cusValImage.IsValid = false;
e.Cancel = true;
}
}


3. Finally, what's the exact URL in the browser's address bar when this error occurs?

http://localhost:10327/Site/ManagePhotoAlbum.aspx?PhotoAlbumId=1032

4. Is there a photo album ID in the query string?
I did ot understand exactly where...

Thank you for your help...
Reply With Quote