Object reference not set to an instance of an objecObject reference not set to an instance of an object.

Hey, I am trying to get the value of the checkbox without_prices in the page_Load, i got this error: 

Server Error in '/' Application.

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.
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

My code is as follows:

<

HTML dir="rtl">

<HEAD>

<title>subjects</title>

<script language="JavaScript">

 

function

checkAll(checkAllItems)

{

var frm = document.form1;

var actVar = checkAllItems.checked;

for(i=0;i< frm.length;i++)

{

e=frm.elements[i];

if ( e.type=='checkbox' && e.name.indexOf("checkItem") != -1 )

e.checked= actVar;

}

}

function

UnCheck()

{

var frm = document.form1;

for(i=0;i< frm.length;i++)

{

e=frm.elements[i];

if ( e.type=='checkbox' && e.name.indexOf("checkAllItems") != -1 )

{

e.checked=

false ;

break;

}

}

}

</script>

<meta content="Microsoft Visual Studio .NET 7.1" name="GENERATOR">

<meta content="Visual Basic .NET 7.1" name="CODE_LANGUAGE">

<meta content="JavaScript" name="vs_defaultClientScript">

<meta content="http://schemas.microsoft.com/intellisense/ie5" name="vs_targetSchema">

</HEAD>

<body style="FONT-SIZE: 10pt; FONT-FAMILY: tahoma" MS_POSITIONING="GridLayout">

<form id="form1" name="form1" method="post" runat="server">

<uc1:menu id="Menu1" runat="server"></uc1:menu><br>

<asp:label id="lwarning" runat="server" Visible="False" ForeColor="Red"></asp:label><BR>

<P>إنشاء نشرة إصدارات

<asp:dropdownlist id="lstItems" runat="server" AutoPostBack="True">

<asp:ListItem Value="1">كتب</asp:ListItem>

<asp:ListItem Value="2">موسيقى</asp:ListItem>

<asp:ListItem Value="3">برامج</asp:ListItem>

<asp:ListItem Value="4">أفلام</asp:ListItem>

<asp:ListItem Value="5">لوحات</asp:ListItem>

</asp:dropdownlist>&nbsp;في

<asp:dropdownlist id="lstSubjects" runat="server"></asp:dropdownlist>&nbsp;<asp:button id="bcat" runat="server" Text="إبدأ"></asp:button><br>

</P>

<p>إنشاء نشرة إصدارات<asp:dropdownlist id="lstcreator" runat="server" AutoPostBack="True">

<asp:ListItem Value="1">لمؤلف</asp:ListItem>

<asp:ListItem Value="2">لمغني</asp:ListItem>

<asp:ListItem Value="3">شركة</asp:ListItem>

<asp:ListItem Value="4">لممثل</asp:ListItem>

<asp:ListItem Value="5">لرسام</asp:ListItem>

</asp:dropdownlist>&nbsp;

<asp:textbox id="tcreator" runat="server"></asp:textbox>&nbsp;<asp:button id="bcreator" runat="server" Text="إبدأ"></asp:button><br>

</p>

<p>إنشاء نشرة إصدارات لسلسلة<asp:dropdownlist id="lstseriesitems" runat="server" AutoPostBack="True">

<asp:ListItem Value="1">كتب</asp:ListItem>

<asp:ListItem Value="2">موسيقى</asp:ListItem>

<asp:ListItem Value="4">أفلام</asp:ListItem>

</asp:dropdownlist>&nbsp;

<asp:textbox id="tseries" Runat="server"></asp:textbox>&nbsp;<asp:button id="bseries" runat="server" Text="إبدأ"></asp:button>

<br>

</p>

<br>

<asp:panel id="ltitle" runat="server" Visible="False" Width="100%">

<FONT color="#cc6600"><STRONG>الرجاء إختيار بعض البنود (17 كحد أقصى) عبر النقر على

الزر

&nbsp;&nbsp;أدناه&nbsp;&nbsp;لإنشاء نشرة الإصدارات الخاصة بك</STRONG></FONT></asp:panel>

<br>

<asp:datagrid id="dgItems" runat="server" Visible="False" Width="100%" PagerStyle-NextPageText=">"

PagerStyle-PrevPageText="<" AutoGenerateColumns="false" PageSize="17" AllowPaging="true" BorderWidth="1"

borderColor="#000000" Font-Size="10">

<Columns>

<asp:BoundColumn Visible="False" DataField="id"></asp:BoundColumn>

<asp:BoundColumn Visible="False" DataField="idautosub"></asp:BoundColumn>

<asp:BoundColumn Visible="False" DataField="center"></asp:BoundColumn>

<asp:TemplateColumn>

<HeaderTemplate>

<input type="checkbox" name="checkAllItems" id="checkAllItems" runat="server" onclick="checkAll(this)">

</HeaderTemplate>

<ItemTemplate>

<input type="checkbox" runat="server" id="checkItem" name="checkItem" onclick="UnCheck();"

checked='<%#DetermineChecked(DataBinder.Eval(Container.DataItem, "id"),DataBinder.Eval(Container.DataItem, "center"),DataBinder.Eval(Container.DataItem, "idautosub"))%>'>

</ItemTemplate>

</asp:TemplateColumn>

<asp:TemplateColumn HeaderText="الكل">

<ItemTemplate>

<%

#DetermineImage(DataBinder.Eval(Container.DataItem, "id"),DataBinder.Eval(Container.DataItem, "center"),DataBinder.Eval(Container.DataItem, "itemformat"),DataBinder.Eval(Container.DataItem, "idautosub"))%>

</ItemTemplate>

</asp:TemplateColumn>

<asp:TemplateColumn>

<ItemTemplate>

<br>

<b>

<%

#DataBinder.Eval(Container.DataItem, "title")%>

</b>

<br>

<%

#DetermineDesc(DataBinder.Eval(Container.DataItem, "descp"),DataBinder.Eval(Container.DataItem, "descp1"),DataBinder.Eval(Container.DataItem, "descp2"))%>

<br>

<%

#DeterminePrices(DataBinder.Eval(Container.DataItem, "alldiscount"),DataBinder.Eval(Container.DataItem, "profit"),DataBinder.Eval(Container.DataItem, "price"),DataBinder.Eval(Container.DataItem, "realprice"),DataBinder.Eval(Container.DataItem, "id"))%>

</ItemTemplate>

</asp:TemplateColumn>

</Columns>

<PagerStyle NextPageText="&gt;" PrevPageText="&lt;" HorizontalAlign="Center" Position="TopAndBottom"

Mode="NumericPages"></PagerStyle>

</asp:datagrid>

<p><asp:button id="Bsubmit" runat="server" Visible="False" Text="إبدأ" Width="56px"></asp:button>

<asp:CheckBox ID="without_prices" Text="بدون أسعار" Visible="False" Checked ="False" Runat="server"></asp:CheckBox>

<asp:label id="lvendorcodes" runat="server" Visible="False"></asp:label><asp:label id="lfolder" runat="server" Visible="false"></asp:label><asp:label id="lvalue1" runat="server" Visible="false"></asp:label><asp:label id="lvalue2" runat="server" Visible="false"></asp:label><asp:label id="loption" style="Z-INDEX: 101; LEFT: 232px; POSITION: absolute; TOP: 1480px"

runat="server"></asp:label>

<asp:Label id="lsubscriber" style="Z-INDEX: 102; LEFT: 193px; POSITION: absolute; TOP: 1488px"

runat="server" Visible="False"></asp:Label></p>

<uc1:footer id="Footer1" runat="server"></uc1:footer></form>

</body>

</

HTML>

--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

In the page Load i want to get the value of without_prices checked as follows:

Session(

"checked") = without_prices.Checked

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

Please can i know why am i getting this error and how can i fix it.

thank you in advance

Hiba

0
Hiba84
12/4/2006 1:55:26 PM
asp.net.presentation-controls 72751 articles. 3 followers. Follow

0 Replies
1355 Views

Similar Articles

[PageSpeed] 22

Reply:

Similar Artilces:

Object reference not set to an instance of an object. System.NullReferenceException: Object reference not set to an instance of an object.
Here's the scenario I have a running code in my localhost using windows xp with microsoft visual studio .net 2003 installed. No problem running the application. But when I transfered the application to a windows server no microsoft visual studio .net 2003 installed. i encountered 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 ref...

Please help me: DotNetNuke.Services.Exceptions.ModuleLoadException: Object reference not set to an instance of an object. ---> System.NullReferenceException: Object reference not set to an instance of
I'm using Dotnetnuke v3.2, when add 1 module, I got this error   "Error: Edit is currently unavailable.    DotNetNuke.Services.Exceptions.ModuleLoadException: Object reference not set to an instance of an object. ---> System.NullReferenceException: Object reference not set to an instance of an object. at DanPhong.DNN.Modules.DDTS.DDTSEdit.btnAddNew_Click(Object sender, EventArgs e) in d:\dnn3\desktopmodules\ddts\ddtsedit.ascx.cs:line 95 --- End of inner exception stack trace ---"Please help....How will I fix this error?  Thanx! Looking at the error y...

Object reference not set to an instance of an object (user controls)
I have a user control WebsiteFooter.ascx. In the code-behind I have public void Test() { ..... } // Then in the parent page code-behind Website.aspx.cs I have the script protected WebsiteFooter WebsiteFooter1; and the following script in the Page_Render event: WebsiteFooter WebsiteFooter1 = new WebsiteFooter(); this.WebsiteFooter1.Test(); When I run the program I get the message: Object reference not set to an instance of an object. I would appreciate suggestion to resolve this problem. Thank you. That's not going to work. I'm not sure what ...

Object reference not set to an instance of an object. in Repeater control
 Hi I m using Repeater control in my shopping cart.Here i show cart items in ViewCart.aspx page <asp:Repeater ID="rptCartItems" runat="server">                    <HeaderTemplate>                    <table width="500px" border="2" style="font: 8pt verdana; border-collapse: collapse; border-spacing: 0px; border: 1px solid #000000;">&n...

What does "Object reference not set to an instance of an object" mean in this instance?
I get this err msg: "Object reference not set to an instance of an object. Line 317:      con.Open();Line 318:      sTypeCode = command.ExecuteScalar().ToString();" Here is the greater context:     public string GetUnitTypeCodeForSerialNum( string ASerialNumber )    {      string sTypeCode;      SqlConnection con = new SqlConnection(        ConfigurationManager.ConnectionStrings[      &...

Object reference not set to an instance of an object. When trying to set textfield to visible
This is the first time I've tried using a listview, and I'm stuggling with just one last piece.   I have the listview set up to display lots of data from a sql query.  I then manually added a radiobuttonlist and a textfield to the listview so that these are also displayed for each record returned by the sql query. If the user selects a certain radiobutton, I then want to set the texfield to visible to prompt the user to provide more info.  But, when I click the radiobutton, the page tries to postback and the page throws this error   Object reference not...

User Control Error: Object reference not set to an instance of an object.
Hi Object reference not set to an instance of an object.HiI have two user controls, UC1 and UC2. UC2 is nested in UC1. What I want to do is to call the UC2's  method (BindGrid()) from UC1's code behind. e.g.UC2 code:namespace UC2public class thisUC2 : System.Web.UI.UserControlpublic BindGrid(){} UC1 code:using UC2;public thisUC2 myUC2; private GetData(){   myUC2.BindGrid();}The compile is ok, also the datagrid in UC2 is still binded with right data, but I get the error message: Object reference not set to an instance of an object.Could anyone know what the ...

Object reference not set to an instance of an object.
Hello, I have a Visual Studio 2005 project (ASP.NET/C# Website) with 8 User Controls, 4 of which have the following problem:When I build the project, I get an "Object reference not set to an instance of an object." error on line 1 of the .ascx files. This is the Control tag, which looks like:<%@ Control Language="C#" AutoEventWireup="true" CodeFile="CodeBehind.ascx.cs" Inherits="Namespace.CodeBehind" %> The Inherits and CodeFile are set to the correct values, and the C# class extends System.Web.UI.UserControl.  The o...

User Control Error
Hi, I am having some problems with a user control The user control is defined like this:- namespace chapter_12A { using System; using System.Data; using System.Drawing; using System.Web; using System.Web.UI.WebControls; using System.Web.UI.HtmlControls; /// <summary> /// Summary description for FragmentCache. /// </summary> public class FragmentCache : System.Web.UI.UserControl { protected System.Web.UI.WebControls.Label Message; protected System.Web.UI.WebControls.Label Label2; private void Page_Load(object sen...

Object reference not set to an instance of an object on Designer for custom control
 HelloI am fairly new to .NET and have a problem - I hope someone can help me.I'm using VS2005 / .NET 2.0. I have a website that must support multiple languages. In a class library I created an interface and controls (like the button control, literal, checkbox etc.) that use this interface and overwrite the render function to give additional multilingual functionality to these controls. (I got my idea from the following website: http://www.codeproject.com/KB/aspnet/localization_websites.aspx).  After compiling the class library and including the created DLL into my website, I p...

Error Rendering Control / Object reference not set to an instance of an object
Hello everone, I have a MainPage.aspx in it I have a Multiview where I inserted Project.ascx. The Web User Control uses: atlas:autocompleteExtender, CollapsiblePanelextender, popupControlExtender. I get in the Design Mode the Error "Error Rendering Control / Object reference not set to an instance of an object"(On DesignMode of Project.ascx) and when I execute the page I get an Error "RuntimeError in JScript: Object required" (The Project.ascx works but this Error happens, when I run another Web User Control with a simple update panel, Textbox and Button). Is there a god way to debug this...

User control problem. Object reference not set to an instance of an object
hi, i have a user control which has a simple DropDownList it also have a property GetValue which gets the value of the selected item and returns strings. Here is the basic Usercontrol code public string GetValue { get { return DropDownList1.SelectedValue.ToString(); } } private void Page_Load(object sender, System.EventArgs e) { if(!Page.IsPostBack) { } } #region Web Form Designer generated code override protected void OnInit(EventArgs e) { // // CODEGEN: This call...

Error creating control, Object reference not set to an instance of an object
Hi, I have looked through this site to find the answer to my problem and have found this link: http://forums.asp.net/p/931932/1094727.aspx#1094727 which is kind of on the correct path. My problem: When adding any control from the web forms toolbox to the page in design mode, the control shows, "Error Creating Control". When the mouse is hovered over the control the IDE reports, "Object reference not set to an instance of an object", is displayed. This problem does not exist on newly created solutions/projects.  Other developers in the team can add contr...

Instantiating Custom Control
Hello all, first time poster here. I have created a custom control that I am trying to add on my page programmatically.  If I write the asp markup for the control on the .aspx file, it works fine.  However, when I try to add text to the control's properties using c#, it throws the object reference error mentioned above.  For example: CustomControl mycontrol = new CustomControl();      mycontrol.bodytext = "lorem ipsum....";PlaceHolder1.Controls.Add(mycontrol);---------------- Bodytext is a property of the CustomControl clas...

Web resources about - Object reference not set to an instance of an objecObject reference not set to an instance of an object. - asp.net.presentation-controls

Resources last updated: 1/19/2016 3:24:17 AM