473,770 Members | 1,953 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

ServerError:Obj ect reference not set to an instance of an object.

7 New Member
Hi,

Im working on migration of one proj from .Net1.1 to2.0 in that some pages are unble to run;

on Debug i havent obeserved ani error at any line but in IE .getting this error

ServerError:Obj ect reference not set to an instance of an object.

Expand|Select|Wrap|Line Numbers
  1. using System;
  2. using System.Data;
  3. using System.Configuration;
  4. using System.Collections;
  5. using System.Web;
  6. using System.Web.Security;
  7. using System.Web.UI;
  8. using System.Web.UI.WebControls;
  9. using System.Web.UI.WebControls.WebParts;
  10. using System.Web.UI.HtmlControls;
  11.  
  12. /// <summary>
  13. /// Summary description for DCA_Reassign.
  14. /// </summary>
  15. public partial class Presentation_DCAdmin_DCA_Reassign : System.Web.UI.Page
  16. {
  17.  
  18.     protected void Page_Load(object sender, EventArgs e)
  19.     {
  20.         Response.Cache.SetCacheability(HttpCacheability.NoCache);
  21.         CommonUI.CheckUser();
  22.         CommonUI.FillHeader(litHeader, "Diagnostic Center Admin");
  23.         btnView.Attributes.Add("onclick", "return validate();");
  24.         Session["pid"] = "1";
  25.         if (!IsPostBack)
  26.         {
  27.             Session["pid"] = "1";
  28.             DC_Admin objDCAdmin = new DC_Admin(Session["UserId"].ToString());
  29.             objDCAdmin.InsertUsageCount("P", Convert.ToInt32(Session["pid"].ToString()));
  30.             tblNoData.Visible = false;
  31.             tblDetails.Visible = false;
  32.             FillCountryList();
  33.             Response.Write("I am wrkin");
  34.           //  ddlLocation.Items.Insert(0, new ListItem("--Select--", "0"));
  35.           //  ddlDiagnosticCenter.Items.Insert(0, new ListItem("--Select--", "0"));
  36.         }
  37.         // Put user code to initialize the page here
  38.  
  39.     }
  40.  
  41.     private void FillCountryList()
  42.     {
  43.         try
  44.         {
  45.             DC_Admin objDCAdmin = new DC_Admin(Session["UserId"].ToString());
  46.             DataSet dsDetails = objDCAdmin.DC_GetCountryNames();
  47.             CommonUI.FillDropdown(ddlCountry, dsDetails.Tables[0], "COUNTRY_NAME", "COUNTRY_CODE", "--Select--", "--Select--");
  48.             objDCAdmin = null;
  49.         }
  50.         catch
  51.         {
  52.         }
  53.     }
  54.  
  55.     #region Web Form Designer generated code
  56.     override protected void OnInit(EventArgs e)
  57.     {
  58.         //
  59.         // CODEGEN: This call is required by the ASP.NET Web Form Designer.
  60.         //
  61.         if (Session["UserID"] == null)
  62.         {
  63.             Session["UserID"] = "0";
  64.         }
  65.         InitializeComponent();
  66.         base.OnInit(e);
  67.         CommonUI.LoadDefaults(BodyID, litHeader, Session["UserID"].ToString());
  68.     }
  69.  
  70.     /// <summary>
  71.     /// Required method for Designer support - do not modify
  72.     /// the contents of this method with the code editor.
  73.     /// </summary>
  74.     private void InitializeComponent()
  75.     {
  76.         this.grdDetails.ItemCommand += new System.Web.UI.WebControls.DataGridCommandEventHandler(this.grdDetails_ItemCommand);
  77.  
  78.     }
  79.     #endregion
  80.  
  81.  
  82.     protected void ddlCountry_SelectedIndexChanged(object sender, EventArgs e)
  83.     {
  84.         string CountryCode = Convert.ToString(ddlCountry.SelectedValue);
  85.         try
  86.         {
  87.             DC_Admin objDCAdmin = new DC_Admin(Session["UserId"].ToString());
  88.             DataSet dsDetails = objDCAdmin.DC_GetCityNames(CountryCode);
  89.             CommonUI.FillDropdown(ddlLocation, dsDetails.Tables[0], "CCM_CITY_DESC", "CCM_NEW_CTY_CODE", "--Select--", "--Select--");
  90.         }
  91.         catch
  92.         { }
  93.         ddlDiagnosticCenter.Items.Clear();
  94.         ddlDiagnosticCenter.Items.Insert(0, new ListItem("--Select--", "-1"));
  95.         ddlDiagnosticCenter.ClearSelection();
  96.         ddlDiagnosticCenter.Items[0].Selected = true;
  97.     }
  98.     protected void ddlLocation_SelectedIndexChanged(object sender, EventArgs e)
  99.     {
  100.         string CityCode = Convert.ToString(ddlLocation.SelectedValue);
  101.         try
  102.         {
  103.             DC_Admin objDCAdmin = new DC_Admin(Session["UserId"].ToString());
  104.             DataSet dsDetails = objDCAdmin.DC_GetDCName(CityCode);
  105.             CommonUI.FillDropdown(ddlDiagnosticCenter, dsDetails.Tables[0], "DC_VENDOR_NAME", "DC_VENDOR_ID", "--Select--", "--Select--");
  106.         }
  107.         catch
  108.         { }
  109.         ddlDiagnosticCenter.ClearSelection();
  110.         ddlDiagnosticCenter.Items[0].Selected = true;
  111.     }
  112.     protected void btnView_Click(object sender, EventArgs e)
  113.     {
  114.         CommonUI.CheckUser();
  115.         int CandidateId = -1;
  116.         if (txtCandId.Text.Trim() != "")
  117.             CandidateId = Convert.ToInt32(txtCandId.Text);
  118.         string CandidateName = "-1";
  119.         if (txtCandName.Text.Trim() != "")
  120.             CandidateName = txtCandName.Text.Trim();
  121.         string Country = Convert.ToString(ddlCountry.SelectedValue.Trim().ToString());
  122.         string Location = Convert.ToString(ddlLocation.SelectedValue.Trim().ToString());
  123.         string DCId = ddlDiagnosticCenter.SelectedValue.Trim().ToString();
  124.  
  125.         try
  126.         {
  127.             DC_Admin objDCAdmin = new DC_Admin(Session["UserId"].ToString());
  128.             DataSet dsDetails = objDCAdmin.DC_Getcandidate_Deatails(CandidateId, CandidateName, Country, Location, DCId, 2);
  129.             if (dsDetails.Tables[0].Rows.Count > 0)
  130.             {
  131.                 tblNoData.Visible = false;
  132.                 tblDetails.Visible = true;
  133.                 grdDetails.DataSource = dsDetails;
  134.                 grdDetails.DataBind();
  135.             }
  136.             else
  137.             {
  138.                 tblNoData.Visible = true;
  139.                 tblDetails.Visible = false;
  140.             }
  141.         }
  142.         catch
  143.         { }
  144.  
  145.     }
  146.  
  147.     protected void grdDetails_ItemCommand(object source, DataGridCommandEventArgs e)
  148.     {
  149.         if (e.CommandName.ToString() == "Reassign")
  150.         {
  151.             int CandidateId = Convert.ToInt32(e.Item.Cells[0].Text.ToString());
  152.             Response.Redirect("ReassignCandidate.aspx?CandidateId=" + CandidateId);
  153.         }
  154.     }
  155. }
pls suggest a solution for this

thanks&regards

Swathi
Nov 20 '08 #1
2 1405
kenobewan
4,871 Recognized Expert Specialist
Please do something first with your catch blocks and report back. Thanks.
Nov 20 '08 #2
r035198x
13,262 MVP
The error message should also have contained the exact line number where that exception was thrown.
Nov 20 '08 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

6
1481
by: SMG | last post by:
Hi , Sory for incomplete message in last post here is the actual problem.. I am using following code in web.confiig for trapping all the error through out my site.. <customErrors mode="On" defaultRedirect="WebForm1.aspx"> <error statusCode="404" redirect="ServerError.aspx"></error> <error statusCode="500" redirect="WebForm3.aspx"></error>
3
10296
by: JRey | last post by:
Does .Net generate the classes for Faults when they are specified in the WSDL. I tried defining them and then generating a proxy, and it did not appear to do it. On the Java side it did generate the class and the ability to serialize that class when putting it on the wire. I was hoping a .Net client would create the appropriate exception class defined in the WSDL and deserialize the message into the appropriate exception class.
1
4986
by: GAURAV KRISHNA | last post by:
I am able to deserialize an array using XMLSerializer but the size of an array is 0.The problem seems to be because of unqualified element name but I am not very sure. Here is what I did: I get the following xml from the server ===================================================
2
2087
by: Jonathan Woods | last post by:
Hi there, I have encountered problem of losing data sending over internet using web service. I consume web service that connected Oracle Database. I submit 687 SOAP Messages to 1 Web Method concurrently. (With synchronize method) public bool SubmitDPSuccessResult(string dpNo,string tkNo,string
0
9453
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10099
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10036
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9904
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8929
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7451
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6710
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5481
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3607
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.