Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Submit Form Question

Status
Not open for further replies.

quinnipiac0807

Programmer
Oct 25, 2004
38
US
I have a form, and when I click the Submit button I get this error.

Object reference not set to an instance of an object.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.NullReferenceException: Object reference not set to an instance of an object.

Source Error:


Line 130:
Line 131: projecttask.TaskOrderID = Convert.ToInt32(ddlTaskOrder.SelectedItem.Value);
Line 132: projecttask.ProjectDescID = Convert.ToInt32(ddlProjectDesc.SelectedItem.Value);
Line 133: projecttask.Save(iProjectTaskID);
Line 134:


Source File: c:\inetpub\ Line: 132

Stack Trace:


[NullReferenceException: Object reference not set to an instance of an object.]
Usis.briefCASE.psd.ProjectDetail.SubmitForm() in c:\inetpub\ Usis.briefCASE.psd.ProjectDetail.btnPost_Click(Object sender, EventArgs e) in c:\inetpub\ System.Web.UI.WebControls.Button.OnClick(EventArgs e) +108
System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +57
System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +18
System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +33
System.Web.UI.Page.ProcessRequestMain() +1277

The code on line 132 is where I get the error, but line 131 works fine. Does anyone have any idea why this is doing this or have any suggestions?

Thanks in advance
 
Have you debugged it?
It seems to me that one of projecttask.ProjectDescID, ddlProjectDesc.SelectedItem or ddlProjectDesc.SelectedItem.Value is null...
If so, try to see why and where it happens. Most common mistake: an object was not initialized.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top