G
Guest
The codebehind is as follows:
I have instenced the DataSet dsclub2a
protected System.Data.DataSet dsclub2a;
and I have instanced the DropdownList as follows:
protected System.Web.UI.WebControls.DropDownList ConCat1;
public void ContactCat()
{
dsclub2a=new DataSet();
clubconn=new SqlConnection(strclubconn);
clubadapt2=new SqlDataAdapter(strConCat,clubconn);
clubadapt2.Fill(dsclub2a,"ConCatagory");
ConCat1.DataSource=dsclub2a;
ConCat1.DataMember="ConCatagory";
ConCat1.DataTextField="Catagory";
ConCat1.DataValueField="ContactID";
ConCat1.DataBind();
}
In the Interface HTML file I have typed the following:
<asp
ropDownList id="ConCat1" runat="server"></asp
ropDownList>
I keep getting the following 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 219: clubadapt2.Fill(dsclub2a,"ConCatagory");
Line 220:
Line 221: ConCat1.DataSource=dsclub2a;
Line 222: ConCat1.DataMember="ConCatagory";
Line 223: ConCat1.DataTextField="Catagory";
Source File: c:\inetpub\wwwroot\sonar3\secured\usergrid.aspx.cs Line: 221
Stack Trace:
[NullReferenceException: Object reference not set to an instance of an
object.]
Sonar3.Secured.UserGrid.ContactCat() in
c:\inetpub\wwwroot\sonar3\secured\usergrid.aspx.cs:221
Sonar3.Secured.UserGrid.Edit_Click(Object sender,
DataGridCommandEventArgs e) in
c:\inetpub\wwwroot\sonar3\secured\usergrid.aspx.cs:72
System.Web.UI.WebControls.DataGrid.OnEditCommand(DataGridCommandEventArgs
e)
System.Web.UI.WebControls.DataGrid.OnBubbleEvent(Object source, EventArgs
e)
System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs args)
System.Web.UI.WebControls.DataGridItem.OnBubbleEvent(Object source,
EventArgs e)
System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs args)
System.Web.UI.WebControls.LinkButton.OnCommand(CommandEventArgs e)
System.Web.UI.WebControls.LinkButton.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument)
System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler
sourceControl, String eventArgument)
System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData)
System.Web.UI.Page.ProcessRequestMain()
Both ConCat1 and dsclub2a have been referanced properly. I do not know what
object the error message is refering to. I have used other names for these
objects as well and it still returns the same error. Is there something I am
missing?
I'm in real big trouble here I need to fix this. If someone can help me
figure it out I'll be truly greatful.
Sam-
I have instenced the DataSet dsclub2a
protected System.Data.DataSet dsclub2a;
and I have instanced the DropdownList as follows:
protected System.Web.UI.WebControls.DropDownList ConCat1;
public void ContactCat()
{
dsclub2a=new DataSet();
clubconn=new SqlConnection(strclubconn);
clubadapt2=new SqlDataAdapter(strConCat,clubconn);
clubadapt2.Fill(dsclub2a,"ConCatagory");
ConCat1.DataSource=dsclub2a;
ConCat1.DataMember="ConCatagory";
ConCat1.DataTextField="Catagory";
ConCat1.DataValueField="ContactID";
ConCat1.DataBind();
}
In the Interface HTML file I have typed the following:
<asp
I keep getting the following 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 219: clubadapt2.Fill(dsclub2a,"ConCatagory");
Line 220:
Line 221: ConCat1.DataSource=dsclub2a;
Line 222: ConCat1.DataMember="ConCatagory";
Line 223: ConCat1.DataTextField="Catagory";
Source File: c:\inetpub\wwwroot\sonar3\secured\usergrid.aspx.cs Line: 221
Stack Trace:
[NullReferenceException: Object reference not set to an instance of an
object.]
Sonar3.Secured.UserGrid.ContactCat() in
c:\inetpub\wwwroot\sonar3\secured\usergrid.aspx.cs:221
Sonar3.Secured.UserGrid.Edit_Click(Object sender,
DataGridCommandEventArgs e) in
c:\inetpub\wwwroot\sonar3\secured\usergrid.aspx.cs:72
System.Web.UI.WebControls.DataGrid.OnEditCommand(DataGridCommandEventArgs
e)
System.Web.UI.WebControls.DataGrid.OnBubbleEvent(Object source, EventArgs
e)
System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs args)
System.Web.UI.WebControls.DataGridItem.OnBubbleEvent(Object source,
EventArgs e)
System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs args)
System.Web.UI.WebControls.LinkButton.OnCommand(CommandEventArgs e)
System.Web.UI.WebControls.LinkButton.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument)
System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler
sourceControl, String eventArgument)
System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData)
System.Web.UI.Page.ProcessRequestMain()
Both ConCat1 and dsclub2a have been referanced properly. I do not know what
object the error message is refering to. I have used other names for these
objects as well and it still returns the same error. Is there something I am
missing?
I'm in real big trouble here I need to fix this. If someone can help me
figure it out I'll be truly greatful.
Sam-