G
Guest
I keep getting the following exception 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 215: clubdg.DataBind();
Line 216:
Line 217: concat.DataSource=dsclub;
Line 218: concat.DataMember=dsclub.Tables["ConCat"].ToString();
Line
219: concat.DataTextField=dsclub.Tables["ConCat"].Columns["Catagory"].ToString();
Source File: c:\inetpub\wwwroot\sonar3\secured\usergrid.aspx.cs Line: 217
Stack Trace:
[NullReferenceException: Object reference not set to an instance of an
object.]
Sonar3.Secured.UserGrid.BindData() in
c:\inetpub\wwwroot\sonar3\secured\usergrid.aspx.cs:217
Sonar3.Secured.UserGrid.Page_Load(Object sender, EventArgs e) in
c:\inetpub\wwwroot\sonar3\secured\usergrid.aspx.cs:67
System.Web.UI.Control.OnLoad(EventArgs e)
System.Web.UI.Control.LoadRecursive()
System.Web.UI.Page.ProcessRequestMain()
This error is refering to the following Code Behind:
protected System.Web.UI.WebControls.DropDownList concat;
protected System.Web.UI.WebControls.DataGrid clubdg;
string strclubconn=ConfigurationSettings.AppSettings["ConnectionString"];
protected System.Web.UI.WebControls.HyperLink HyperLink1;
string userselect="SELECT User_tbl.*, ConCat.* FROM User_tbl, ConCat WHERE
User_tbl.concat=Concat.ContactID ORDER BY UserID Desc";
string strConCat="SELECT ConCat.* FROM ConCat";
public void BindData()
{
dsclub=new DataSet();
clubconn=new SqlConnection(strclubconn);
clubconn.Open();
clubadapt=new SqlDataAdapter(userselect,clubconn);
clubadapt.Fill(dsclub,"UserTbl");
clubadapt.SelectCommand=new SqlCommand(strConCat,clubconn);
clubadapt.Fill(dsclub,"ConCat");
clubconn.Close();
clubdg.DataSource=dsclub;
clubdg.DataMember=dsclub.Tables["UserTbl"].ToString();
clubdg.DataBind();
concat.DataSource=dsclub;
concat.DataMember=dsclub.Tables["ConCat"].ToString();
concat.DataTextField=dsclub.Tables["ConCat"].Columns["Catagory"].ToString();
concat.DataValueField=dsclub.Tables["ConCat"].Columns["ContactID"].ToString();
concat.DataBind();
}
This is the Front End DropDownList control: the error is refering to:
<aspropDownList ID="concat" Runat="server"></aspropDownList>
I don't know where the null referance is if any one can tell me what the
problem is I'd greatly appreciate it.
Sam I am-
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 215: clubdg.DataBind();
Line 216:
Line 217: concat.DataSource=dsclub;
Line 218: concat.DataMember=dsclub.Tables["ConCat"].ToString();
Line
219: concat.DataTextField=dsclub.Tables["ConCat"].Columns["Catagory"].ToString();
Source File: c:\inetpub\wwwroot\sonar3\secured\usergrid.aspx.cs Line: 217
Stack Trace:
[NullReferenceException: Object reference not set to an instance of an
object.]
Sonar3.Secured.UserGrid.BindData() in
c:\inetpub\wwwroot\sonar3\secured\usergrid.aspx.cs:217
Sonar3.Secured.UserGrid.Page_Load(Object sender, EventArgs e) in
c:\inetpub\wwwroot\sonar3\secured\usergrid.aspx.cs:67
System.Web.UI.Control.OnLoad(EventArgs e)
System.Web.UI.Control.LoadRecursive()
System.Web.UI.Page.ProcessRequestMain()
This error is refering to the following Code Behind:
protected System.Web.UI.WebControls.DropDownList concat;
protected System.Web.UI.WebControls.DataGrid clubdg;
string strclubconn=ConfigurationSettings.AppSettings["ConnectionString"];
protected System.Web.UI.WebControls.HyperLink HyperLink1;
string userselect="SELECT User_tbl.*, ConCat.* FROM User_tbl, ConCat WHERE
User_tbl.concat=Concat.ContactID ORDER BY UserID Desc";
string strConCat="SELECT ConCat.* FROM ConCat";
public void BindData()
{
dsclub=new DataSet();
clubconn=new SqlConnection(strclubconn);
clubconn.Open();
clubadapt=new SqlDataAdapter(userselect,clubconn);
clubadapt.Fill(dsclub,"UserTbl");
clubadapt.SelectCommand=new SqlCommand(strConCat,clubconn);
clubadapt.Fill(dsclub,"ConCat");
clubconn.Close();
clubdg.DataSource=dsclub;
clubdg.DataMember=dsclub.Tables["UserTbl"].ToString();
clubdg.DataBind();
concat.DataSource=dsclub;
concat.DataMember=dsclub.Tables["ConCat"].ToString();
concat.DataTextField=dsclub.Tables["ConCat"].Columns["Catagory"].ToString();
concat.DataValueField=dsclub.Tables["ConCat"].Columns["ContactID"].ToString();
concat.DataBind();
}
This is the Front End DropDownList control: the error is refering to:
<aspropDownList ID="concat" Runat="server"></aspropDownList>
I don't know where the null referance is if any one can tell me what the
problem is I'd greatly appreciate it.
Sam I am-