473,407 Members | 2,359 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,407 software developers and data experts.

ServerError:Object reference not set to an instance of an object.

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:Object 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 1389
kenobewan
4,871 Expert 4TB
Please do something first with your catch blocks and report back. Thanks.
Nov 20 '08 #2
r035198x
13,262 8TB
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
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"...
3
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...
1
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...
2
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...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
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...
0
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...
0
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...

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.